Yes, the hostname was the only problem. When mongod is started and the replica set is configured, the node is is assigned the Docker’s hostname as the name of host that is added to the replica set, so it’s easier to connect to it from the other services in Compose. If you don’t specify hostname, Docker will assign a random name every time you restart the container but that may conflict with the data that is persisted in the volume.

1 Like