You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker中MongoDB Atlas Local因密钥文件权限异常无法启动求助

MongoDB Atlas Local容器启动失败:keyfile所有者异常导致无法读取

问题背景

我通过Docker Compose运行mongodb/mongodb-atlas-local:7.0.15镜像,配置参考官方文档。服务之前能正常运行,突然无法启动。我已经尝试删除所有相关镜像、卷并重建,甚至重装了Rancher桌面,但问题依然存在。

错误日志

启动时出现以下错误日志:

{"t":{"$date":"2025-04-23T13:57:28.797Z"},"s":"I",  "c":"CONTROL",  "id":5760901, "ctx":"main","msg":"Applied --setParameter options","attr":{"serverParameters":{"mongotHost":{"default":"","value":"localhost:27027"},"searchIndexManagementHostAndPort":{"default":"","value":"localhost:27027"}}}}
{"t":{"$date":"2025-04-23T13:57:28.802+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient": {"minWireVersion":0,"maxWireVersion":21},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":21},"outgoing":{"minWireVersion":6,"maxWireVersion":21},"isInternalClient":true}}}
{"t":{"$date":"2025-04-23T13:57:28.802+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":"2025-04-23T13:57:28.803+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":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ACCESS",   "id":20254,   "ctx":"main","msg":"Read security file failed","attr":{"error":{"code":30,"codeName":"InvalidPath","errmsg":"error opening file: /data/configdb/keyfile: bad file"}}}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":6529201, "ctx":"main","msg":"Network interface redundant shutdown","attr":{"state":"Stopped"}}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"main","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":6529201, "ctx":"main","msg":"Network interface redundant shutdown","attr":{"state":"Stopped"}}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"main","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":6529201, "ctx":"main","msg":"Network interface redundant shutdown","attr":{"state":"Stopped"}}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"main","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"SHARDING", "id":5847201, "ctx":"main","msg":"Balancer command scheduler stop requested"}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":6529201, "ctx":"main","msg":"Network interface redundant shutdown","attr":{"state":"Stopped"}}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"main","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2025-04-23T13:57:28.804+00:00"},"s":"F",  "c":"CONTROL",  "id":20575,   "ctx":"main","msg":"Error creating service context","attr":{"error":"Location5579201: Unable to acquire security key[s]"}}
Error: error checking mongod: error pinging: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: localhost:27017, Type: Unknown, Last error: dial tcp [::1]:27017: connect: connection refused }, ] }

文件权限检查

进入容器shell查看/data/configdb/keyfile,文件确实存在,但所有者异常:

sh-5.1$ ls -l /data/configdb/
total 4
-r-------- 1 systemd-coredump mongod 416 Apr  2 08:18 keyfile

正常情况下该文件所有者应为mongod,但当前是systemd-coredump,且我无法修改该文件的权限或所有者。

Docker Compose配置

我的docker-compose.yaml内容如下:

services:
  mongodb:
    container_name: mongodb
    hostname: mongodb
    image: mongodb/mongodb-atlas-local:7.0.15
    ports:
      - 27018:27017
    environment:
      - MONGODB_INITDB_DATABASE=db
      - MONGODB_INITDB_ROOT_USERNAME=user
      - MONGODB_INITDB_ROOT_PASSWORD=pass
    volumes:
      - data:/data/db
      - config:/data/configdb
      # Fix issues with rebooting and not persisting the vector search index
      - mongot:/data/mongot

volumes:
  data:
  config:
  mongot:

补充信息

  • 在另一台电脑上部署相同配置无异常,keyfile所有者为mongod
  • 已尝试清理所有Docker镜像、卷,重装Rancher桌面,问题仍未解决
  • 不想通过重装系统解决问题

内容的提问来源于stack exchange,提问作者François MENTEC

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 07:44:52