Mongodb/mongodb-atlas-local docker container cannot re-create containers using docker-compose

I am following this documentation to standup atlas using docker-compose, and everything works the first go of it, but when trying to persist data across runs with docker-compose, the container logs show that the process starts, encounters an error, and then the container shuts down shortly afterwards.

Below are the logs:

2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.921Z”},“s”:“I”, “c”:“CONTROL”, “id”:5760901, “ctx”:“main”,“msg”:“Applied --setParameter options”,“attr”:{“serverParameters”:{“mongotHost”:{“default”:“”,“value”:“localhost:27027”},“searchIndexManagementHostAndPort”:{“default”:“”,“value”:“localhost:27027”}}}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.923+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’”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.923+00:00”},“s”:“I”, “c”:“CONTROL”, “id”:5945603, “ctx”:“main”,“msg”:“Multi threading initialized”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:4648601, “ctx”:“main”,“msg”:“Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set at least one of the related parameters”,“attr”:{“relatedParameters”:[“tcpFastOpenServer”,“tcpFastOpenClient”,“tcpFastOpenQueueSize”]}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ACCESS”, “id”:20254, “ctx”:“main”,“msg”:“Read security file failed”,“attr”:{“error”:{“code”:30,“codeName”:“InvalidPath”,“errmsg”:“Error reading file /data/configdb/keyfile: No such file or directory”}}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:6529201, “ctx”:“main”,“msg”:“Network interface redundant shutdown”,“attr”:{“state”:“Stopped”}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:22582, “ctx”:“main”,“msg”:“Killing all outstanding egress activity.”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:6529201, “ctx”:“main”,“msg”:“Network interface redundant shutdown”,“attr”:{“state”:“Stopped”}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:22582, “ctx”:“main”,“msg”:“Killing all outstanding egress activity.”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:6529201, “ctx”:“main”,“msg”:“Network interface redundant shutdown”,“attr”:{“state”:“Stopped”}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:22582, “ctx”:“main”,“msg”:“Killing all outstanding egress activity.”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“SHARDING”, “id”:5847201, “ctx”:“main”,“msg”:“Balancer command scheduler stop requested”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:6529201, “ctx”:“main”,“msg”:“Network interface redundant shutdown”,“attr”:{“state”:“Stopped”}}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“I”, “c”:“ASIO”, “id”:22582, “ctx”:“main”,“msg”:“Killing all outstanding egress activity.”}
2024-11-12 10:59:32 {“t”:{“$date”:“2024-11-12T15:59:32.924+00:00”},“s”:“F”, “c”:“CONTROL”, “id”:20575, “ctx”:“main”,“msg”:“Error creating service context”,“attr”:{“error”:“Location5579201: Unable to acquire security key[s]”}}
2024-11-12 11:01:32 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 }, ] }
2024-11-12 11:01:32 Usage:
2024-11-12 11:01:32 runner server [flags]
2024-11-12 11:01:32
2024-11-12 11:01:32 Flags:
2024-11-12 11:01:32 -h, --help help for server
2024-11-12 11:01:32
2024-11-12 11:01:32 panic: 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 }, ] }
2024-11-12 11:01:32
2024-11-12 11:01:32 goroutine 1 [running]:
2024-11-12 11:01:32 main.main()
2024-11-12 11:01:32 /app/cmd/runner/main.go:65 +0x184

My environment:
Apple M1 Pro - OS v14.7
Docker Desktop - v4.35.1

There’s been some activity on figuring this issue out over the last few days in another post here, and it looks like the documentation has been updated within the last few hours to include a working example.