Open alitoufighi opened 4 years ago
To solve this, I think a simple sleep
would be a workaround.
A better fix would be watching data directory until it becomes non-empty, and then running workloop.
I had forgotten that you can't write to a mongod
started with --replSet
option when a Replica Set is not initiated.
So my above solutions are not valid for this case.
I think the problem was with my approach to initialize my replica set database in this way. If anyone can confirm this, I think we can close the issue.
I am stuck in a situation where I need to populate my Replica Set with some data, while using this sidecar to initiate the Replica Set and scale it automatically.
What I have is a mongo container with a script mounted in
/docker-entrypoint-initdb.d/
and running this sidecar aside it. Since this sidecar runs asynchronously with the mongo, we have no guarantee when mongo's docker entrypoint script will check for its data directory being empty, hence by running mongo commands, this sidecar will cause the data directory to be not empty.