Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It did not work when I bound mount a local filesystem to container on Linux #430

Closed
shanezhiu opened this issue Oct 27, 2020 · 4 comments
Closed
Labels
question Usability question, not directly related to an error with the image

Comments

@shanezhiu
Copy link

shanezhiu commented Oct 27, 2020

Environment

Distributor ID: Debian
Description: Debian GNU/Linux bullseye/sid
Release: testing
Codename: bullseye

local filesystem info

File: data/
Size: 166 Blocks: 0 IO Block: 4096 directory
Device: 3dh/61d Inode: 40657089 Links: 1
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2020-10-27 21:00:34.383395930 +0800
Modify: 2020-10-27 20:58:55.955035295 +0800
Change: 2020-10-27 21:00:25.615364085 +0800
Birth: 2020-10-27 19:55:34.320386231 +0800

Dockerfile

FROM mongo:4.4.1-bionic

LABEL MAINTAINER="shanezhiu <shanezhiu@gmail.com>"

ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf"]

docker-compose.yml

version: "3.8"

services: 
    mongo:
        build: ./
        restart: "always"
        expose: 
            - "27017"
            - "27016"
        environment: 
            MONGO_INITDB_ROOT_USERNAME: test
            MONGO_INITDB_ROOT_PASSWORD: test
        volumes: 
            - "./conf/mongod.conf:/etc/mongod.conf"
            - "./data:/var/lib/mongodb"
            - "./log:/var/log/mongodb"

        networks: 
            mongo_service:
                ipv4_address: 172.23.0.2
                ipv6_address: 2001:3984:3989::1

networks: 
    mongo_service:
        driver: bridge
        ipam:
            config:
                - subnet: "172.23.0.0/16"
                - subnet: "2001:3984:3989::/64"

mongod.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo
  fork: true

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

error-log

{"t":{"$date":"2020-10-27T13:00:37.594+00:00"},"s":"E", "c":"STORAGE", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803637:594335][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}

question

By searching this error-log from goole, I know that binding mout method may fail on Windows or Mac.

But there is not any explains about how and why does it occurs on Linux.

reference

strapi/strapi-docker#80

@shanezhiu shanezhiu changed the title It does not work when I bound mount a local filesystem to container on Linux It did not work when I bound mount a local filesystem to container on Linux Oct 27, 2020
@wglambert wglambert added the question Usability question, not directly related to an error with the image label Oct 27, 2020
@wglambert
Copy link

Can you post the full log output, the error shown exited with 0 but I don't know what events caused that. If it were corrupted data it would say something like metadata corruption in the output

Are you encountering this on an uninitialized empty ./data volume or a pre-populated one?
If you remove the ./data mount does it work fine?

@yosifkit
Copy link
Member

You should definitely remove fork: true from your config file, otherwise the container will have no foreground process to track and just exit.

Did you create ./data beforehand with permissions such that the mongodb user of the container would be able to access it? If not, then docker will create both the path inside and outside the container as root owned and mongod will be unable to do anything with it.

@shanezhiu
Copy link
Author

shanezhiu commented Oct 28, 2020

Can you post the full log output, the error shown exited with 0 but I don't know what events caused that. If it were corrupted data it would say something like metadata corruption in the output

Are you encountering this on an uninitialized empty ./data volume or a pre-populated one?

an empty ./data

If you remove the ./data mount does it work fine?

Yes, if I remove the ./data mount, it works fine.

{"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-27T13:00:00.312+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2020-10-27T13:00:00.312+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"processManagement":{"fork":true,"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/var/lib/mongodb","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
{"t":{"$date":"2020-10-27T13:00:00.313+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7435M,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-27T13:00:02.753+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803602:753046][8:0x7f2a8fff6a80], txn-recover: __hs_exists, 627: WiredTigerHS.wt file is corrupted or missing: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:02.753+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803602:753151][8:0x7f2a8fff6a80], txn-recover: __wt_txn_recover, 893: Recovery failed: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:02.786+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803602:786428][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}
{"t":{"$date":"2020-10-27T13:00:02.786+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803602:786530][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 377: cache server: exiting with 69431 bytes in memory"}}
{"t":{"$date":"2020-10-27T13:00:02.786+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803602:786555][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 383: cache server: exiting with 69270 bytes dirty and 1 pages dirty"}}
{"t":{"$date":"2020-10-27T13:00:04.231+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803604:231022][8:0x7f2a8fff6a80], txn-recover: __hs_exists, 627: WiredTigerHS.wt file is corrupted or missing: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:04.231+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803604:231443][8:0x7f2a8fff6a80], txn-recover: __wt_txn_recover, 893: Recovery failed: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:04.322+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803604:322323][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}
{"t":{"$date":"2020-10-27T13:00:04.322+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803604:322403][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 377: cache server: exiting with 69431 bytes in memory"}}
{"t":{"$date":"2020-10-27T13:00:04.322+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803604:322430][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 383: cache server: exiting with 69270 bytes dirty and 1 pages dirty"}}
{"t":{"$date":"2020-10-27T13:00:06.002+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803606:2180][8:0x7f2a8fff6a80], txn-recover: __hs_exists, 627: WiredTigerHS.wt file is corrupted or missing: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:06.002+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803606:2266][8:0x7f2a8fff6a80], txn-recover: __wt_txn_recover, 893: Recovery failed: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:06.011+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803606:11631][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}
{"t":{"$date":"2020-10-27T13:00:06.011+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803606:11700][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 377: cache server: exiting with 69431 bytes in memory"}}
{"t":{"$date":"2020-10-27T13:00:06.011+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803606:11722][8:0x7f2a8fff6a80], connection: __wt_cache_destroy, 383: cache server: exiting with 69270 bytes dirty and 1 pages dirty"}}
{"t":{"$date":"2020-10-27T13:00:06.013+00:00"},"s":"W",  "c":"STORAGE",  "id":22347,   "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2020-10-27T13:00:06.013+00:00"},"s":"F",  "c":"-",        "id":23089,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28559,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp","line":64}}
{"t":{"$date":"2020-10-27T13:00:06.013+00:00"},"s":"F",  "c":"-",        "id":23090,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
{"t":{"$date":"2020-10-27T13:00:06.013+00:00"},"s":"F",  "c":"CONTROL",  "id":4757800, "ctx":"initandlisten","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}
{"t":{"$date":"2020-10-27T13:00:06.073+00:00"},"s":"I",  "c":"CONTROL",  "id":31431,   "ctx":"initandlisten","msg":"BACKTRACE: {bt}","attr":{"bt":{"backtrace":[{"a":"55D4F9CD89F1","b":"55D4F7010000","o":"2CC89F1","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.606","s+":"1E1"},{"a":"55D4F9CDA029","b":"55D4F7010000","o":"2CCA029","s":"_ZN5mongo15printStackTraceEv","s+":"29"},{"a":"55D4F9CD7886","b":"55D4F7010000","o":"2CC7886","s":"_ZN5mongo12_GLOBAL__N_116abruptQuitActionEiP9siginfo_tPv","s+":"66"},{"a":"7F2A8E4028A0","b":"7F2A8E3F0000","o":"128A0","s":"funlockfile","s+":"50"},{"a":"7F2A8E03DF47","b":"7F2A8DFFF000","o":"3EF47","s":"gsignal","s+":"C7"},{"a":"7F2A8E03F8B1","b":"7F2A8DFFF000","o":"408B1","s":"abort","s+":"141"},{"a":"55D4F7F18BDA","b":"55D4F7010000","o":"F08BDA","s":"_ZN5mongo25fassertFailedWithLocationEiPKcj","s+":"12B"},{"a":"55D4F7C0694C","b":"55D4F7010000","o":"BF694C","s":"_ZN5mongo17wtRCToStatus_slowEiPKc.cold.1021","s+":"16"},{"a":"55D4F8016420","b":"55D4F7010000","o":"1006420","s":"_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_","s+":"630"},{"a":"55D4F801DA8A","b":"55D4F7010000","o":"100DA8A","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mmbbbb","s+":"12DA"},{"a":"55D4F7FFB9B0","b":"55D4F7010000","o":"FEB9B0","s":"_ZNK5mongo12_GLOBAL__N_117WiredTigerFactory6createERKNS_19StorageGlobalParamsEPKNS_21StorageEngineLockFileE","s+":"120"},{"a":"55D4F88C183E","b":"55D4F7010000","o":"18B183E","s":"_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE","s+":"4AE"},{"a":"55D4F7FB61E7","b":"55D4F7010000","o":"FA61E7","s":"_ZN5mongo12_GLOBAL__N_114_initAndListenEPNS_14ServiceContextEi.isra.1569","s+":"3F7"},{"a":"55D4F7FBA280","b":"55D4F7010000","o":"FAA280","s":"_ZN5mongo12_GLOBAL__N_111mongoDbMainEiPPcS2_","s+":"650"},{"a":"55D4F7F28B99","b":"55D4F7010000","o":"F18B99","s":"main","s+":"9"},{"a":"7F2A8E020B97","b":"7F2A8DFFF000","o":"21B97","s":"__libc_start_main","s+":"E7"},{"a":"55D4F7FB569A","b":"55D4F7010000","o":"FA569A","s":"_start","s+":"2A"}],"processInfo":{"mongodbVersion":"4.4.1","gitVersion":"ad91a93a5a31e175f5cbf8c69561e788bbc55ce1","compiledModules":[],"uname":{"sysname":"Linux","release":"5.9.0-1-amd64","version":"#1 SMP Debian 5.9.1-1 (2020-10-17)","machine":"x86_64"},"somap":[{"b":"55D4F7010000","elfType":3,"buildId":"832AC9AE6CC5692FB33A92460CF800BB1B8C176A"},{"b":"7F2A8E3F0000","path":"/lib/x86_64-linux-gnu/libpthread.so.0","elfType":3,"buildId":"BC3C06107774266C5F7DB3F1F380A3DA68AF90FA"},{"b":"7F2A8DFFF000","path":"/lib/x86_64-linux-gnu/libc.so.6","elfType":3,"buildId":"D3CF764B2F97AC3EFE366DDD07AD902FB6928FD7"}]}}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F9CD89F1","b":"55D4F7010000","o":"2CC89F1","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.606","s+":"1E1"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F9CDA029","b":"55D4F7010000","o":"2CCA029","s":"_ZN5mongo15printStackTraceEv","s+":"29"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F9CD7886","b":"55D4F7010000","o":"2CC7886","s":"_ZN5mongo12_GLOBAL__N_116abruptQuitActionEiP9siginfo_tPv","s+":"66"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7F2A8E4028A0","b":"7F2A8E3F0000","o":"128A0","s":"funlockfile","s+":"50"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7F2A8E03DF47","b":"7F2A8DFFF000","o":"3EF47","s":"gsignal","s+":"C7"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7F2A8E03F8B1","b":"7F2A8DFFF000","o":"408B1","s":"abort","s+":"141"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7F18BDA","b":"55D4F7010000","o":"F08BDA","s":"_ZN5mongo25fassertFailedWithLocationEiPKcj","s+":"12B"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7C0694C","b":"55D4F7010000","o":"BF694C","s":"_ZN5mongo17wtRCToStatus_slowEiPKc.cold.1021","s+":"16"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F8016420","b":"55D4F7010000","o":"1006420","s":"_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_","s+":"630"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F801DA8A","b":"55D4F7010000","o":"100DA8A","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mmbbbb","s+":"12DA"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7FFB9B0","b":"55D4F7010000","o":"FEB9B0","s":"_ZNK5mongo12_GLOBAL__N_117WiredTigerFactory6createERKNS_19StorageGlobalParamsEPKNS_21StorageEngineLockFileE","s+":"120"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F88C183E","b":"55D4F7010000","o":"18B183E","s":"_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE","s+":"4AE"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7FB61E7","b":"55D4F7010000","o":"FA61E7","s":"_ZN5mongo12_GLOBAL__N_114_initAndListenEPNS_14ServiceContextEi.isra.1569","s+":"3F7"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7FBA280","b":"55D4F7010000","o":"FAA280","s":"_ZN5mongo12_GLOBAL__N_111mongoDbMainEiPPcS2_","s+":"650"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7F28B99","b":"55D4F7010000","o":"F18B99","s":"main","s+":"9"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"7F2A8E020B97","b":"7F2A8DFFF000","o":"21B97","s":"__libc_start_main","s+":"E7"}}}
{"t":{"$date":"2020-10-27T13:00:06.074+00:00"},"s":"I",  "c":"CONTROL",  "id":31427,   "ctx":"initandlisten","msg":"  Frame: {frame}","attr":{"frame":{"a":"55D4F7FB569A","b":"55D4F7010000","o":"FA569A","s":"_start","s+":"2A"}}}

{"t":{"$date":"2020-10-27T13:00:33.769+00:00"},"s":"W",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
{"t":{"$date":"2020-10-27T13:00:33.771+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-27T13:00:33.784+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-10-27T13:00:33.784+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-27T13:00:33.785+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":7,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"b3260c8e7656"}}
{"t":{"$date":"2020-10-27T13:00:33.785+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-27T13:00:33.785+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2020-10-27T13:00:33.785+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"processManagement":{"fork":true,"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/var/lib/mongodb","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
{"t":{"$date":"2020-10-27T13:00:33.786+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7435M,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-27T13:00:35.822+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803635:822960][7:0x7f382c6b4a80], txn-recover: __hs_exists, 627: WiredTigerHS.wt file is corrupted or missing: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:35.823+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803635:823048][7:0x7f382c6b4a80], txn-recover: __wt_txn_recover, 893: Recovery failed: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:35.848+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803635:848012][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}
{"t":{"$date":"2020-10-27T13:00:35.848+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803635:848107][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 377: cache server: exiting with 69431 bytes in memory"}}
{"t":{"$date":"2020-10-27T13:00:35.848+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803635:848157][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 383: cache server: exiting with 69270 bytes dirty and 1 pages dirty"}}
{"t":{"$date":"2020-10-27T13:00:37.396+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803637:396171][7:0x7f382c6b4a80], txn-recover: __hs_exists, 627: WiredTigerHS.wt file is corrupted or missing: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:37.396+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":-31809,"message":"[1603803637:396307][7:0x7f382c6b4a80], txn-recover: __wt_txn_recover, 893: Recovery failed: WT_TRY_SALVAGE: database corruption detected"}}
{"t":{"$date":"2020-10-27T13:00:37.594+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803637:594335][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 369: cache server: exiting with 2 pages in memory and 0 pages evicted"}}
{"t":{"$date":"2020-10-27T13:00:37.594+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803637:594430][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 377: cache server: exiting with 69431 bytes in memory"}}
{"t":{"$date":"2020-10-27T13:00:37.594+00:00"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":0,"message":"[1603803637:594452][7:0x7f382c6b4a80], connection: __wt_cache_destroy, 383: cache server: exiting with 69270 bytes dirty and 1 pages dirty"}}

@shanezhiu
Copy link
Author

shanezhiu commented Oct 28, 2020

You should definitely remove fork: true from your config file, otherwise the container will have no foreground process to track and just exit.

Did you create ./data beforehand with permissions such that the mongodb user of the container would be able to access it? If not, then docker will create both the path inside and outside the container as root owned and mongod will be unable to do anything with it.

Thanks for you! I checked agian, and I overlooked the problem of permissions of the data directory.

my solution is:

  • create user in my host:
groupadd -gid 1010 mongodb

useradd -g mongo -u 1010 -M -s /bin/sbin/nologin mongodb
  • add user in Dockerfile

FROM mongo:4.4.1-bionic

LABEL MAINTAINER="shanezhiu <shanezhiu@gmail.com>"

USER 1010:1010

ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf"]

And then it works for me.

Thanks agian for you patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants