docker-library / mongo

Docker Official Image packaging for MongoDB
https://www.mongodb.org/
Apache License 2.0
1.03k stars 620 forks source link

MONGO_INITDB_DATABASE and directory docker-entrypoint-initdb.d not running. #429

Closed theabner closed 3 years ago

theabner commented 4 years ago

I am trying to create a database with the MONGO_INITDB_DATABASE command but it is not being created. I'm also trying to create a user from a mongo-init.js javascript within the /docker-entrypoint-initdb.d directory but it doesn't work either. I'm using a mongo image: 4.4.1

Does anyone know what can it be?

docker-compose.yml

version: "3.1"

networks:
  database:
  server:
  client:

services:
  db:
    image: mongo:4.4.1
    container_name: Banco-de-Dados
    restart: always
    command: --auth
    environment:
      MONGO_INITDB_DATABASE: collabty
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: teste
    ports:
      - 22222:27017
    volumes:
      - ./Server/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
      - dbdata:/data/db
    networks:
      - database

volumes:
  dbdata:

mongo-init.js

db.auth('root', 'teste')

db = db.getSiblingDB('test-database')

db.createUser({
  user: "theabnermatheus",
  pwd: "teste",
  roles: [{role: "readWrite", db: "collabty"}]
});

I checked the directories and everything is correct, I entered the container and navigated to the /docker-entrypoint-initdb.d directory and the mongo-init.js file is inside, however the script is not creating the user.

wglambert commented 4 years ago

What do the docker logs show?

It seems like dbdata is already initialized, in which case the entrypoint won't modify any data and skips

theabner commented 4 years ago

What do the docker logs show?

It seems like dbdata is already initialized, in which case the entrypoint won't modify any data and skips

{"t":{"$date":"2020-10-23T18:29:46.939+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}

{"t":{"$date":"2020-10-23T18:29:46.941+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}

{"t":{"$date":"2020-10-23T18:29:46.942+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}

{"t":{"$date":"2020-10-23T18:29:46.942+00:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"5567375aa999"}}

{"t":{"$date":"2020-10-23T18:29:46.942+00:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.1","gitVersion":"ad91a93a5a31e175f5cbf8c69561e788bbc55ce1","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}

{"t":{"$date":"2020-10-23T18:29:46.942+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}

{"t":{"$date":"2020-10-23T18:29:46.942+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"},"security":{"authorization":"enabled"}}}}

{"t":{"$date":"2020-10-23T18:29:46.943+00:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}

{"t":{"$date":"2020-10-23T18:29:46.943+00:00"},"s":"I", "c":"STORAGE", "id":22297, "ctx":"initandlisten","msg":"Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem","tags":["startupWarnings"]}

{"t":{"$date":"2020-10-23T18:29:46.943+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=5801M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}

{"t":{"$date":"2020-10-23T18:29:47.335+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:335444][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 11 through 12"}}

{"t":{"$date":"2020-10-23T18:29:47.373+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:373865][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 12 through 12"}}

{"t":{"$date":"2020-10-23T18:29:47.418+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:418569][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Main recovery loop: starting at 11/22784 to 12/256"}}

{"t":{"$date":"2020-10-23T18:29:47.465+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:465805][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 11 through 12"}}

{"t":{"$date":"2020-10-23T18:29:47.507+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:507701][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 12 through 12"}}

{"t":{"$date":"2020-10-23T18:29:47.530+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:530825][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}}

{"t":{"$date":"2020-10-23T18:29:47.530+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1603477787:530886][1:0x7f8efa509a80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global oldest timestamp: (0, 0)"}}

{"t":{"$date":"2020-10-23T18:29:47.574+00:00"},"s":"I", "c":"STORAGE", "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":631}}

{"t":{"$date":"2020-10-23T18:29:47.574+00:00"},"s":"I", "c":"RECOVERY", "id":23987, "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}

{"t":{"$date":"2020-10-23T18:29:47.577+00:00"},"s":"I", "c":"STORAGE", "id":22262, "ctx":"initandlisten","msg":"Timestamp monitor starting"}

{"t":{"$date":"2020-10-23T18:29:47.599+00:00"},"s":"W", "c":"CONTROL", "id":22178, "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}

{"t":{"$date":"2020-10-23T18:29:47.613+00:00"},"s":"I", "c":"STORAGE", "id":20536, "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}

{"t":{"$date":"2020-10-23T18:29:47.617+00:00"},"s":"I", "c":"FTDC", "id":20625, "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}

{"t":{"$date":"2020-10-23T18:29:47.619+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}

{"t":{"$date":"2020-10-23T18:29:47.619+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}

{"t":{"$date":"2020-10-23T18:29:47.619+00:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}

{"t":{"$date":"2020-10-23T18:30:20.377+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41150","connectionId":1,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:30:20.379+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn1","msg":"client metadata","attr":{"remote":"192.168.80.1:41150","client":"conn1","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:20.389+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41154","connectionId":2,"connectionCount":2}}

{"t":{"$date":"2020-10-23T18:30:20.392+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn2","msg":"client metadata","attr":{"remote":"192.168.80.1:41154","client":"conn2","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:20.395+00:00"},"s":"I", "c":"ACCESS", "id":20251, "ctx":"conn2","msg":"Supported SASL mechanisms requested for unknown user","attr":{"user":"theabnermatheus@admin"}}

{"t":{"$date":"2020-10-23T18:30:20.396+00:00"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn2","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-256","principalName":"theabnermatheus","authenticationDatabase":"admin","client":"192.168.80.1:41154","result":"UserNotFound: Could not find user \"theabnermatheus\" for db \"admin\""}}

{"t":{"$date":"2020-10-23T18:30:20.399+00:00"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn2","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","principalName":"theabnermatheus","authenticationDatabase":"admin","client":"192.168.80.1:41154","result":"UserNotFound: Could not find user \"theabnermatheus\" for db \"admin\""}}

{"t":{"$date":"2020-10-23T18:30:20.405+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn1","msg":"Connection ended","attr":{"remote":"192.168.80.1:41150","connectionId":1,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:30:20.409+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn2","msg":"Connection ended","attr":{"remote":"192.168.80.1:41154","connectionId":2,"connectionCount":0}}

{"t":{"$date":"2020-10-23T18:30:21.598+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41158","connectionId":3,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:30:21.598+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn3","msg":"client metadata","attr":{"remote":"192.168.80.1:41158","client":"conn3","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:21.602+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41162","connectionId":4,"connectionCount":2}}

{"t":{"$date":"2020-10-23T18:30:21.602+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn4","msg":"client metadata","attr":{"remote":"192.168.80.1:41162","client":"conn4","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:21.603+00:00"},"s":"I", "c":"ACCESS", "id":20251, "ctx":"conn4","msg":"Supported SASL mechanisms requested for unknown user","attr":{"user":"theabnermatheus@admin"}}

{"t":{"$date":"2020-10-23T18:30:21.603+00:00"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn4","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-256","principalName":"theabnermatheus","authenticationDatabase":"admin","client":"192.168.80.1:41162","result":"UserNotFound: Could not find user \"theabnermatheus\" for db \"admin\""}}

{"t":{"$date":"2020-10-23T18:30:21.605+00:00"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn4","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","principalName":"theabnermatheus","authenticationDatabase":"admin","client":"192.168.80.1:41162","result":"UserNotFound: Could not find user \"theabnermatheus\" for db \"admin\""}}

{"t":{"$date":"2020-10-23T18:30:21.609+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn3","msg":"Connection ended","attr":{"remote":"192.168.80.1:41158","connectionId":3,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:30:21.609+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn4","msg":"Connection ended","attr":{"remote":"192.168.80.1:41162","connectionId":4,"connectionCount":0}}

{"t":{"$date":"2020-10-23T18:30:25.004+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41166","connectionId":5,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:30:25.004+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn5","msg":"client metadata","attr":{"remote":"192.168.80.1:41166","client":"conn5","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.010+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41170","connectionId":6,"connectionCount":2}}

{"t":{"$date":"2020-10-23T18:30:25.010+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn6","msg":"client metadata","attr":{"remote":"192.168.80.1:41170","client":"conn6","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.024+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn6","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41170"}}

{"t":{"$date":"2020-10-23T18:30:25.091+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41174","connectionId":7,"connectionCount":3}}

{"t":{"$date":"2020-10-23T18:30:25.091+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41178","connectionId":8,"connectionCount":4}}

{"t":{"$date":"2020-10-23T18:30:25.093+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41182","connectionId":9,"connectionCount":5}}

{"t":{"$date":"2020-10-23T18:30:25.093+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41186","connectionId":10,"connectionCount":6}}

{"t":{"$date":"2020-10-23T18:30:25.097+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41190","connectionId":11,"connectionCount":7}}

{"t":{"$date":"2020-10-23T18:30:25.099+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn9","msg":"client metadata","attr":{"remote":"192.168.80.1:41182","client":"conn9","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.099+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn7","msg":"client metadata","attr":{"remote":"192.168.80.1:41174","client":"conn7","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.099+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn8","msg":"client metadata","attr":{"remote":"192.168.80.1:41178","client":"conn8","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.100+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn10","msg":"client metadata","attr":{"remote":"192.168.80.1:41186","client":"conn10","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.103+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn11","msg":"client metadata","attr":{"remote":"192.168.80.1:41190","client":"conn11","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:30:25.104+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn8","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41178"}}

{"t":{"$date":"2020-10-23T18:30:25.104+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn9","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41182"}}

{"t":{"$date":"2020-10-23T18:30:25.104+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn7","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41174"}}

{"t":{"$date":"2020-10-23T18:30:25.105+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn10","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41186"}}

{"t":{"$date":"2020-10-23T18:30:25.126+00:00"},"s":"I", "c":"ACCESS", "id":20250, "ctx":"conn11","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"root","authenticationDatabase":"admin","client":"192.168.80.1:41190"}}

{"t":{"$date":"2020-10-23T18:30:36.350+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.80.1:41194","connectionId":12,"connectionCount":8}}

{"t":{"$date":"2020-10-23T18:30:36.350+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn12","msg":"client metadata","attr":{"remote":"192.168.80.1:41194","client":"conn12","doc":{"driver":{"name":"nodejs","version":"3.6.0"},"os":{"type":"Windows_NT","name":"win32","architecture":"x64","version":"10.0.18362"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}

{"t":{"$date":"2020-10-23T18:36:25.154+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn10","msg":"Connection ended","attr":{"remote":"192.168.80.1:41186","connectionId":10,"connectionCount":7}}

{"t":{"$date":"2020-10-23T18:36:25.155+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn7","msg":"Connection ended","attr":{"remote":"192.168.80.1:41174","connectionId":7,"connectionCount":6}}

{"t":{"$date":"2020-10-23T18:36:25.155+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn6","msg":"Connection ended","attr":{"remote":"192.168.80.1:41170","connectionId":6,"connectionCount":5}}

{"t":{"$date":"2020-10-23T18:36:25.159+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn8","msg":"Connection ended","attr":{"remote":"192.168.80.1:41178","connectionId":8,"connectionCount":4}}

{"t":{"$date":"2020-10-23T18:36:25.159+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn9","msg":"Connection ended","attr":{"remote":"192.168.80.1:41182","connectionId":9,"connectionCount":2}}

{"t":{"$date":"2020-10-23T18:36:25.159+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn11","msg":"Connection ended","attr":{"remote":"192.168.80.1:41190","connectionId":11,"connectionCount":3}}

{"t":{"$date":"2020-10-23T18:40:28.144+00:00"},"s":"I", "c":"-", "id":20883, "ctx":"conn5","msg":"Interrupted operation as its client disconnected","attr":{"opId":8186}}

{"t":{"$date":"2020-10-23T18:40:28.145+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn5","msg":"Connection ended","attr":{"remote":"192.168.80.1:41166","connectionId":5,"connectionCount":1}}

{"t":{"$date":"2020-10-23T18:40:28.145+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn12","msg":"Connection ended","attr":{"remote":"192.168.80.1:41194","connectionId":12,"connectionCount":0}}
wglambert commented 4 years ago

Since your volume already contains an initialized database the docker-entrypoint.sh isn't going to modify any existing data

theabner commented 4 years ago

Since your volume already contains an initialized database the docker-entrypoint.sh isn't going to modify any existing data

Hmm .. and how do I solve this? should I run mongo-init.js afterwards?

wglambert commented 4 years ago

Well any entrypoint functionality is going to be ignored, like the MONGO_INITDB_ env vars and the /docker-entrypoint-initdb.d/ directory, so running the script manually is an option

https://github.com/docker-library/docs/tree/master/mongo#initializing-a-fresh-instance

When a container is started for the first time it will execute files with extensions .sh and .js that are found in /docker-entrypoint-initdb.d

You could also try asking over at the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since these repos aren't really a user-help forum

yosifkit commented 4 years ago

If you haven't pushed any important data into MongoDB, just delete it: docker volume rm dbdata (after stopping and removing the container).

cerkutayalp commented 1 year ago

Since your volume already contains an initialized database the docker-entrypoint.sh isn't going to modify any existing data

I had the same, I was recreating image but was not able to connect. Thanks man