Mongodb express不會與docker-compose.yaml組合

每當我嘗試編寫mongodb和mongodb-express時,我都會得到以下錯誤

C:\Users\ayan9\Documents\repository\ayanpal_dot_me [master +2 ~0 -0 !]> docker compose up
[+] Running 3/3
 - Network ayanpal_dot_me_default            Created                                                                                                                                                        0.0s
 - Container ayanpal_dot_me-mongo-express-1  Created                                                                                                                                                        0.0s
 - Container ayanpal_dot_me-mongodb-1        Created                                                                                                                                                        0.0s
Attaching to ayanpal_dot_me-mongo-express-1, ayanpal_dot_me-mongodb-1
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.254+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.255+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.257+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.257+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."}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.258+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"5924e60df736"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.8","gitVersion":"c87e1c23421bf79614baf500fda6622bd90f674e","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.259+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"}}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.261+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"]}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.261+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=15474M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.681+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1652017564:681852][1:0x7ff209735c80], txn-recover: [WT_VERB_RECOVERY_ALL] Set global recovery timestamp: (0, 0)"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.681+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1652017564:681919][1:0x7ff209735c80], txn-recover: [WT_VERB_RECOVERY_ALL] Set global oldest timestamp: (0, 0)"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.690+00:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":429}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.690+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.704+00:00"},"s":"I",  "c":"STORAGE",  "id":4366408, "ctx":"initandlisten","msg":"No table logging settings modifications are required for existing WiredTiger tables","attr":{"loggingEnabled":true}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.704+00:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.714+00:00"},"s":"W",  "c":"CONTROL",  "id":22120,   "ctx":"initandlisten","msg":"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted","tags":["startupWarnings"]}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.714+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"]}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.715+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"admin.system.version","uuidDisposition":"provided","uuid":{"uuid":{"$uuid":"1b6aefca-c53e-42d0-9c9b-d2e8eee30340"}},"options":{"uuid":{"$uuid":"1b6aefca-c53e-42d0-9c9b-d2e8eee30340"}}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.728+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"admin.system.version","index":"_id_","commitTimestamp":null}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.729+00:00"},"s":"I",  "c":"REPL",     "id":20459,   "ctx":"initandlisten","msg":"Setting featureCompatibilityVersion","attr":{"newVersion":"5.0"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.729+00:00"},"s":"I",  "c":"NETWORK",  "id":4915702, "ctx":"initandlisten","msg":"Updated wire specification","attr":{"oldSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true},"newSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":13,"maxWireVersion":13},"outgoing":{"minWireVersion":13,"maxWireVersion":13},"isInternalClient":true}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.729+00:00"},"s":"I",  "c":"NETWORK",  "id":4915702, "ctx":"initandlisten","msg":"Updated wire specification","attr":{"oldSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":13,"maxWireVersion":13},"outgoing":{"minWireVersion":13,"maxWireVersion":13},"isInternalClient":true},"newSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":13,"maxWireVersion":13},"outgoing":{"minWireVersion":13,"maxWireVersion":13},"isInternalClient":true}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.729+00:00"},"s":"I",  "c":"STORAGE",  "id":5071100, "ctx":"initandlisten","msg":"Clearing temp directory"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.729+00:00"},"s":"I",  "c":"CONTROL",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.730+00:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.730+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.startup_log","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"b0eb7b0e-af74-4183-8a67-ecd9e7de29cc"}},"options":{"capped":true,"size":10485760}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.743+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.startup_log","index":"_id_","commitTimestamp":null}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.744+00:00"},"s":"I",  "c":"REPL",     "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigReplicationDisabled","oldState":"ConfigPreStart"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.745+00:00"},"s":"I",  "c":"CONTROL",  "id":20712,   "ctx":"LogicalSessionCacheReap","msg":"Sessions collection is not set up; waiting until next sessions reap interval","attr":{"error":"NamespaceNotFound: config.system.sessions does not exist"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.745+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.745+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.745+00:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.745+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"LogicalSessionCacheRefresh","msg":"createCollection","attr":{"namespace":"config.system.sessions","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"12df9af9-6392-49ea-abe2-84b860973329"}},"options":{}}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.763+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"LogicalSessionCacheRefresh","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"config.system.sessions","index":"_id_","commitTimestamp":null}}
ayanpal_dot_me-mongodb-1        | {"t":{"$date":"2022-05-08T13:46:04.763+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"LogicalSessionCacheRefresh","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"config.system.sessions","index":"lsidTTLIndex","commitTimestamp":null}}
ayanpal_dot_me-mongo-express-1  | Welcome to mongo-express
ayanpal_dot_me-mongo-express-1  | ------------------------
ayanpal_dot_me-mongo-express-1  |
ayanpal_dot_me-mongo-express-1  |
ayanpal_dot_me-mongo-express-1  | (node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
ayanpal_dot_me-mongo-express-1  | Could not connect to database using connectionString: mongodb://mongo:27017"
ayanpal_dot_me-mongo-express-1  | (node:7) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [Error: getaddrinfo EAI_AGAIN mongo
ayanpal_dot_me-mongo-express-1  |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
ayanpal_dot_me-mongo-express-1  |   name: 'MongoNetworkError'
ayanpal_dot_me-mongo-express-1  | }]
ayanpal_dot_me-mongo-express-1  |     at Pool.<anonymous> (/node_modules/mongodb/lib/core/topologies/server.js:441:11)
ayanpal_dot_me-mongo-express-1  |     at Pool.emit (events.js:314:20)
ayanpal_dot_me-mongo-express-1  |     at /node_modules/mongodb/lib/core/connection/pool.js:564:14
ayanpal_dot_me-mongo-express-1  |     at /node_modules/mongodb/lib/core/connection/pool.js:1000:11
ayanpal_dot_me-mongo-express-1  |     at /node_modules/mongodb/lib/core/connection/connect.js:32:7
ayanpal_dot_me-mongo-express-1  |     at callback (/node_modules/mongodb/lib/core/connection/connect.js:300:5)
ayanpal_dot_me-mongo-express-1  |     at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connect.js:330:7)
ayanpal_dot_me-mongo-express-1  |     at Object.onceWrapper (events.js:421:26)
ayanpal_dot_me-mongo-express-1  |     at Socket.emit (events.js:314:20)
ayanpal_dot_me-mongo-express-1  |     at emitErrorNT (internal/streams/destroy.js:92:8)
ayanpal_dot_me-mongo-express-1  |     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
ayanpal_dot_me-mongo-express-1  |     at processTicksAndRejections (internal/process/task_queues.js:84:21)
ayanpal_dot_me-mongo-express-1  | (node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
ayanpal_dot_me-mongo-express-1  | (node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ayanpal_dot_me-mongo-express-1 exited with code 0

我的docker-compose.yaml如下

services:
  mongodb:
    image: mongo
    environment:
      - MONGO_INTIDB_ROOT_USERNAME=rootuser
      - MONGO_INTIDB_ROOT_PASSOWRD=rootpass
  mongo-express:
    image: mongo-express
    ports:
      - 8081:8081
    environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=rootuser
      - ME_CONFIG_MONGODB_ADMINPASSWORD=rootpass

只是試圖通過docker I運行mongodb和mongodb express,我們嘗試將端口添加到mongodb的服務器配置中,mongodb-express也添加了卷和網絡,但這個錯誤非常令人困惑

? 最佳回答:

有兩個問題。首先,Express嘗試使用默認主機名“mongo”連接到數據庫。你的名字叫“mongodb”,所以它找不到。解決這個問題的最簡單方法是將服務命名為mongo,而不是mongodb

現在,mongo-express可以找到mongo容器,但現在出現了第二個問題:mongo-express容器在啟動后立即嘗試連接到mongo數據庫,但mongo數據庫當時還沒有準備好接受連接。解決這個問題的一個簡單方法是將restart選項設置為always,這樣容器就會重新啟動,直到成功。

Try this

version: '3.9'
services:
  mongo:
    image: mongo
    environment:
      - MONGO_INTIDB_ROOT_USERNAME=rootuser
      - MONGO_INTIDB_ROOT_PASSOWRD=rootpass
  mongo-express:
    image: mongo-express
    ports:
      - 8081:8081
    environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=rootuser
      - ME_CONFIG_MONGODB_ADMINPASSWORD=rootpass
    restart: always
    depends_on:
      - mongo
主站蜘蛛池模板: 精品一区二区三区视频在线观看| 精品国产一区二区三区av片| 亚洲一区中文字幕在线电影网| 精品国产一区二区三区久| 中文字幕VA一区二区三区 | 日韩AV无码一区二区三区不卡毛片 | 无码日本电影一区二区网站| 亚洲av无码一区二区乱子伦as| 一本岛一区在线观看不卡| 国产乱码精品一区二区三区四川人| 久久综合精品不卡一区二区| 波多野结衣高清一区二区三区| 日本在线视频一区| 精品一区二区三区无码免费直播| 精品亚洲av无码一区二区柚蜜| 中文字幕AV一区二区三区人妻少妇| 国产对白精品刺激一区二区| 蜜桃无码一区二区三区| 精品一区二区三区四区在线播放 | 无码人妻久久一区二区三区蜜桃| 国产精品久久久久一区二区三区 | 高清一区二区在线观看| 日韩人妻无码免费视频一区二区三区| 精品亚洲AV无码一区二区三区 | 国产美女口爆吞精一区二区| 国产福利电影一区二区三区,免费久久久久久久精| 一区二区三区精密机械| 蜜臀AV无码一区二区三区 | 国产在线一区二区| 无码AV中文一区二区三区| 日韩AV无码久久一区二区| 国产福利一区二区三区视频在线| 国产精品一区视频| 日韩在线视频一区| 久久久久人妻精品一区三寸蜜桃| 亚洲日韩激情无码一区 | 国产品无码一区二区三区在线蜜桃| 国产在线视频一区二区三区98 | 亚洲一区二区三区高清在线观看| 国产精品久久久久一区二区 | 亚洲视频一区在线|