简体   繁体   English

为什么我在 docker-compose 中的 mongo 容器不断退出?

[英]Why does my mongo container in docker-compose keep exiting?

I am trying to set up my project with docker - compose, however the mongo container keeps exitting.我正在尝试使用 docker-compose 设置我的项目,但是 mongo 容器不断退出。

My docker-compose.yml is as follows:docker-compose.yml如下:

version: "3"
services:
       carpool-app:
           container_name: carpool-app
           image: group40/carpool-app
           restart: always
           build: .
           ports:
              - ${PORT}:${PORT}
           env_file: .env
           links:
             - mongo
       mongo:
             container_name: mongo
             hostname: $MONGO_HOST
             image: mongo:latest
             volumes:
               - ./data:/data/db
             ports:
               - ${MONGO_PORT}:${MONGO_PORT}
             env_file: .env

And this is the output in the terminal:这是终端中的输出:

mongo          | {"t":{"$date":"2020-09-19T11:10:47.094+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'"}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.097+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.097+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."}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.098+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":"mongo"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.098+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"}}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.098+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.098+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"}}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.100+00:00"},"s":"W",  "c":"STORAGE",  "id":22271,   "ctx":"initandlisten","msg":"Detected unclean shutdown - Lock file is not empty","attr":{"lockFile":"/data/db/mongod.lock"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.102+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"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.103+00:00"},"s":"W",  "c":"STORAGE",  "id":22302,   "ctx":"initandlisten","msg":"Recovering data from the last clean checkpoint."}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.104+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=483M,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],"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.868+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1600513847:868789][1:0x7fd5c1d68a80], connection: __wt_turtle_read, 385: WiredTiger.turtle: fatal turtle file read error: WT_TRY_SALVAGE: database corruption detected"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.868+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31804,"message":"[1600513847:868883][1:0x7fd5c1d68a80], connection: __wt_turtle_read, 385: the process must exit and restart: WT_PANIC: WiredTiger library panic"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.868+00:00"},"s":"F",  "c":"-",        "id":23089,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":50853,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp","line":446}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.868+00:00"},"s":"F",  "c":"-",        "id":23090,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.868+00:00"},"s":"F",  "c":"CONTROL",  "id":4757800, "ctx":"initandlisten","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.930+00:00"},"s":"I",  "c":"CONTROL",  "id":31431,   "ctx":"initandlisten","msg":"BACKTRACE: {bt}","attr":{"bt":{"backtrace":[{"a":"55B4933139F1","b":"55B49064B000","o":"2CC89F1","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.606","s+":"1E1"},{"a":"55B493315029","b":"55B49064B000","o":"2CCA029","s":"_ZN5mongo15printStackTraceEv","s+":"29"},{"a":"55B493312886","b":"55B49064B000","o":"2CC7886","s":"_ZN5mongo12_GLOBAL__N_116abruptQuitActionEiP9siginfo_tPv","s+":"66"},{"a":"7FD5C01748A0","b":"7FD5C0162000","o":"128A0","s":"funlockfile","s+":"50"},{"a":"7FD5BFDAFF47","b":"7FD5BFD71000","o":"3EF47","s":"gsignal","s+":"C7"},{"a":"7FD5BFDB18B1","b":"7FD5BFD71000","o":"408B1","s":"abort","s+":"141"},{"a":"55B491553BDA","b":"55B49064B000","o":"F08BDA","s":"_ZN5mongo25fassertFailedWithLocationEiPKcj","s+":"12B"},{"a":"55B491241C21","b":"55B49064B000","o":"BF6C21","s":"_ZN5mongo12_GLOBAL__N_141mdb_handle_error_with_startup_suppressionEP18__wt_event_handlerP12__wt_sessioniPKc.cold.1026","s+":"16"},{"a":"55B491722FBB","b":"55B49064B000","o":"10D7FBB","s":"__eventv","s+":"3FB"},{"a":"55B491252B3F","b":"55B49064B000","o":"C07B3F","s":"__wt_panic_func","s+":"10B"},{"a":"55B49124CA10","b":"55B49064B000","o":"C01A10","s":"__wt_turtle_read.cold.7","s+":"4B"},{"a":"55B4916EC2A4","b":"55B49064B000","o":"10A12A4","s":"__wt_turtle_validate_version","s+":"204"},{"a":"55B4916A1EF3","b":"55B49064B000","o":"1056EF3","s":"wiredtiger_open","s+":"28B3"},{"a":"55B491650EAA","b":"55B49064B000","o":"1005EAA","s":"_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_","s+":"BA"},{"a":"55B491658A8A","b":"55B49064B000","o":"100DA8A","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mmbbbb","s+":"12DA"},{"a":"55B4916369B0","b":"55B49064B000","o":"FEB9B0","s":"_ZNK5mongo12_GLOBAL__N_117WiredTigerFactory6createERKNS_19StorageGlobalParamsEPKNS_21StorageEngineLockFileE","s+":"120"},{"a":"55B491EFC83E","b":"55B49064B000","o":"18B183E","s":"_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE","s+":"4AE"},{"a":"55B4915F11E7","b":"55B49064B000","o":"FA61E7","s":"_ZN5mongo12_GLOBAL__N_114_initAndListenEPNS_14ServiceContextEi.isra.1569","s+":"3F7"},{"a":"55B4915F5280","b":"55B49064B000","o":"FAA280","s":"_ZN5mongo12_GLOBAL__N_111mongoDbMainEiPPcS2_","s+":"650"},{"a":"55B491563B99","b":"55B49064B000","o":"F18B99","s":"main","s+":"9"},{"a":"7FD5BFD92B97","b":"7FD5BFD71000","o":"21B97","s":"__libc_start_main","s+":"E7"},{"a":"55B4915F069A","b":"55B49064B000","o":"FA569A","s":"_start","s+":"2A"}],"processInfo":{"mongodbVersion":"4.4.1","gitVersion":"ad91a93a5a31e175f5cbf8c69561e788bbc55ce1","compiledModules":[],"uname":{"sysname":"Linux","release":"4.19.76-linuxkit","version":"#1 SMP Tue May 26 11:42:35 UTC 2020","machine":"x86_64"},"somap":[{"b":"55B49064B000","elfType":3,"buildId":"832AC9AE6CC5692FB33A92460CF800BB1B8C176A"},{"b":"7FD5C0162000","path":"/lib/x86_64-linux-gnu/libpthread.so.0","elfType":3,"buildId":"BC3C06107774266C5F7DB3F1F380A3DA68AF90FA"},{"b":"7FD5BFD71000","path":"/lib/x86_64-linux-gnu/libc.so.6","elfType":3,"buildId":"D3CF764B2F97AC3EFE366DDD07AD902FB6928FD7"}]}}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4933139F1","b":"55B49064B000","o":"2CC89F1","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.606","s+":"1E1"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B493315029","b":"55B49064B000","o":"2CCA029","s":"_ZN5mongo15printStackTraceEv","s+":"29"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B493312886","b":"55B49064B000","o":"2CC7886","s":"_ZN5mongo12_GLOBAL__N_116abruptQuitActionEiP9siginfo_tPv","s+":"66"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7FD5C01748A0","b":"7FD5C0162000","o":"128A0","s":"funlockfile","s+":"50"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7FD5BFDAFF47","b":"7FD5BFD71000","o":"3EF47","s":"gsignal","s+":"C7"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7FD5BFDB18B1","b":"7FD5BFD71000","o":"408B1","s":"abort","s+":"141"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491553BDA","b":"55B49064B000","o":"F08BDA","s":"_ZN5mongo25fassertFailedWithLocationEiPKcj","s+":"12B"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491241C21","b":"55B49064B000","o":"BF6C21","s":"_ZN5mongo12_GLOBAL__N_141mdb_handle_error_with_startup_suppressionEP18__wt_event_handlerP12__wt_sessioniPKc.cold.1026","s+":"16"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491722FBB","b":"55B49064B000","o":"10D7FBB","s":"__eventv","s+":"3FB"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491252B3F","b":"55B49064B000","o":"C07B3F","s":"__wt_panic_func","s+":"10B"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B49124CA10","b":"55B49064B000","o":"C01A10","s":"__wt_turtle_read.cold.7","s+":"4B"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4916EC2A4","b":"55B49064B000","o":"10A12A4","s":"__wt_turtle_validate_version","s+":"204"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4916A1EF3","b":"55B49064B000","o":"1056EF3","s":"wiredtiger_open","s+":"28B3"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491650EAA","b":"55B49064B000","o":"1005EAA","s":"_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_","s+":"BA"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491658A8A","b":"55B49064B000","o":"100DA8A","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mmbbbb","s+":"12DA"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4916369B0","b":"55B49064B000","o":"FEB9B0","s":"_ZNK5mongo12_GLOBAL__N_117WiredTigerFactory6createERKNS_19StorageGlobalParamsEPKNS_21StorageEngineLockFileE","s+":"120"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491EFC83E","b":"55B49064B000","o":"18B183E","s":"_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE","s+":"4AE"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4915F11E7","b":"55B49064B000","o":"FA61E7","s":"_ZN5mongo12_GLOBAL__N_114_initAndListenEPNS_14ServiceContextEi.isra.1569","s+":"3F7"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4915F5280","b":"55B49064B000","o":"FAA280","s":"_ZN5mongo12_GLOBAL__N_111mongoDbMainEiPPcS2_","s+":"650"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B491563B99","b":"55B49064B000","o":"F18B99","s":"main","s+":"9"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7FD5BFD92B97","b":"7FD5BFD71000","o":"21B97","s":"__libc_start_main","s+":"E7"}}}
mongo          | {"t":{"$date":"2020-09-19T11:10:47.931+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55B4915F069A","b":"55B49064B000","o":"FA569A","s":"_start","s+":"2A"}}}
mongo exited with code 14

I have tried changing the permissions of the folders and files involved, but this did not work.我曾尝试更改所涉及的文件夹和文件的权限,但这不起作用。 I also tried removing all docker images and rebuilding images multiple times.我还尝试多次删除所有 docker 图像并重建图像。

Can't see your entire docker-compose file?看不到整个 docker-compose 文件? Did you add the volumes?你添加了卷吗? Here I share, my mongo service that I have for my project.在这里,我分享我为我的项目提供的 mongo 服务。

services:
  mongo:
    image: mongo:jessie
    ports:
      - "27017:27017"
    volumes:
    - mongovol:/data/db
    - mongovol:/data/configdb
volumes:
  mongovol:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM