MongoDB exception in initAndListen: old lock file, terminating

Read Time:1 Minute, 45 Second

Reference: https://github.com/docker-library/mongo/issues/62#issuecomment-568308941

Error Message:

*************
2021-04-30T01:10:54.539+0000 I STORAGE  [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2021-04-30T01:10:54.539+0000 I CONTROL  [initandlisten] dbexit:  rc: 100
2021-04-30T01:10:57.584+0000 I CONTROL  [main] 
2021-04-30T01:10:57.584+0000 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2021-04-30T01:10:57.584+0000 I CONTROL  [main] 
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 32-bit host=6309168606c4
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] db version v3.2.20
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] git version: a7a144f40b70bfe290906eb33ff2714933544af8
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] modules: none
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten] build environment:
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten]     distarch: arm
2021-04-30T01:10:57.599+0000 I CONTROL  [initandlisten]     target_arch: arm
2021-04-30T01:10:57.600+0000 I CONTROL  [initandlisten] options: {}
2021-04-30T01:10:57.609+0000 I -        [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2021-04-30T01:10:57.609+0000 W -        [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2021-04-30T01:10:57.666+0000 I STORAGE  [initandlisten] ************** 
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.

Fix for docker-compose.yml:

mongo:
    container_name: mongo
    image: apcheamitru/arm32v7-mongo:3.2.20
    restart: unless-stopped
    networks:
      - internal
    volumes:
      - mongo_data:/data/db
    command: mongod --repair

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.