Docker compose down always triggering recovering state?

Hi-

I’m using the standard 'mongodb/mongodb-atlas-local" docker image with docker compose for local development, but every time I shut down the container via “docker compose down” it causes some kind of cluster error and after restarting I always get the following: “node is not in primary or recovering state”.

The only solution is to remove the container, rebuild and reimport my database. Any pointers on how to prevent this? I’ve experimented with adding timeouts to the docker compose shutdown but no luck…

Thanks!

Hi @Andrew_Pile , sorry to hear you’re bumping into this state. Would you be able to provide your compose file for me to try and reproduce this, please?

I ended up resolving this by adding a “hostname: mongodb” entry to the compose config… this wasn’t necessary when I first built this but seems to have become required in the past few months.

1 Like

Yes, hostname is a requirement for restarts if you set volumes. Thanks for letting me know you’re back up and running again.