I'm running mongodb/mongodb-atlas-local in Docker, I got the docker-compose from here. It used to work, but it suddenly stopped. I tried deleting every images and volumes and rebuild it but nothing work. Here is the error logs:
{"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 }, ] }
The error is most likely because it cannot access the file /data/configdb/keyfile
. If I attach a shell to the container I can see that the file exists:
sh-5.1$ ls -l /data/configdb/
total 4
-r-------- 1 systemd-coredump mongod 416 Apr 2 08:18 keyfile
I believe the issue is because its owner is systemd-coredump
instead of mongod
, but I failed to change it, also I do not understand why it is not created with the correct ownership and why it used to work, but it doesn't anymore.
The 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:
EDIT: I built the project on another computer without issue, the keyfile correctly belong to mongod. I tried pruning everything and re-installed rancher desktop on my computer, but the issue persists. I don't know what to do at this point. Formatting the computer feels a bit excessive.
I found the solution to my issue. I needed to remove everything related to rancher desktop then re-install it. However, simply uninstall rancher desktop doesn't cut it. You have to purge your computer from everything related to rancher desktop.
It includes WSL distributions, you can list them with this command:
wsl --list --all
And unregister them with this command:
wsl --unregister <distribution-name>
You'll find folders related to rancher desktop in appdata/Local
and appdata/Roaming
.
There are folders in Program Files
and your user folder in C:/Users
.
It is really a pain to find everything, rancher desktop uninstaller is completely useless. Once you made sure everything related to rancher is removed, you can re-install it and the permission issues in your containers should be gone. Good luck.