windows 下 docker 中运行 mongodb 无法启动
docker-compose.yml 内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 | version: '3.1' services: mongo: image: mongo # restart: always ports: - 27017:27017 environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: 911209 volumes: - . /data : /data/db |
如果不注释 restart 则发现一直在重启。
mongodb 容器中日志如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | PS D:\docker\mongo> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f9c2e95e98c mongo "docker-entrypoint.s…" 17 minutes ago Exited (14) 17 minutes ago mongo_mongo_1 8a9ca90b98e1 redis "docker-entrypoint.s…" 12 days ago Up 38 minutes 0.0.0.0:6379->6379 /tcp redis PS D:\docker\mongo> docker logs ^C PS D:\docker\mongo> docker logs 1f9c2e95e98c about to fork child process, waiting until server is ready for connections. forked process: 27 2020-03-10T04:46:37.024+0000 I CONTROL [main] ***** SERVER RESTARTED ***** 2020-03-10T04:46:37.033+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force- enable TLS 1.0 specify --sslDisabledProtocols 'none' 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] MongoDB starting : pid=27 port=27017 dbpath= /data/db 64-bit host=1f9c2e95e98c 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] db version v4.2.3 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] allocator: tcmalloc 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] modules: none 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] build environment: 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] distmod: ubuntu1804 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] distarch: x86_64 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] target_arch: x86_64 2020-03-10T04:46:37.040+0000 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1" , port: 27017, tls: { mode: "disabled" } }, processManagement: { fork: true , pidFilePath: "/tmp/docker-entrypoint-temp-mongod.pid" }, systemLog: { destination: "file" , logAppend: true , path: "/proc/1/fd/1" } } 2020-03-10T04:46:37.049+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=487M,cache_overflow=(file_max=0M),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], 2020-03-10T04:46:38.226+0000 E STORAGE [initandlisten] WiredTiger error (1) [1583815598:226487][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted Raw: [1583815598:226487][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted 2020-03-10T04:46:38.247+0000 E STORAGE [initandlisten] WiredTiger error (17) [1583815598:247816][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : File exists Raw: [1583815598:247816][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : File exists 2020-03-10T04:46:38.251+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.1 2020-03-10T04:46:38.254+0000 E STORAGE [initandlisten] WiredTiger error (1) [1583815598:254167][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted Raw: [1583815598:254167][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted 2020-03-10T04:46:38.272+0000 E STORAGE [initandlisten] WiredTiger error (17) [1583815598:272660][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : File exists Raw: [1583815598:272660][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : File exists 2020-03-10T04:46:38.276+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.2 2020-03-10T04:46:38.278+0000 E STORAGE [initandlisten] WiredTiger error (1) [1583815598:278614][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted Raw: [1583815598:278614][27:0x7f9dfe0d4b00], connection: __posix_open_file, 667: /data/db/WiredTiger .wt: handle- open : open : Operation not permitted 2020-03-10T04:46:38.281+0000 W STORAGE [initandlisten] Failed to start up WiredTiger under any compatibility version. 2020-03-10T04:46:38.281+0000 F STORAGE [initandlisten] Reason: 1: Operation not permitted 2020-03-10T04:46:38.281+0000 F - [initandlisten] Fatal Assertion 28595 at src /mongo/db/storage/wiredtiger/wiredtiger_kv_engine .cpp 789 2020-03-10T04:46:38.281+0000 F - [initandlisten] ***aborting after fassert() failure ERROR: child process failed, exited with error number 14 To see additional information in this output, start without the "--fork" option. |
错误来看好像主要是 Operation not permitted Raw 和 WiredTiger error。
前者应该是啥权限问题,不过没找到解决方案,启动docker的命令行已经是管理员身份,挂载的文件夹也已经给任何用户授权(windows下)。
后面的那个没找到什么办法。
最后在 mongodb 的dockerhub上发现下面这段描述:
这是不是说 windows 下的 docker 跑 mongodb 就无法挂载数据目录出来?
20
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧