docker-library/mongo

`ENTRYPOINT` documentation

make-github-pseudonymous-again opened this issue · 1 comments

Would it be possible to document what the embedded ENTRYPOINT does (globally, or for each version, whichever makes sense)? Took me several hours to figure out the ECONNREFUSED was caused by me overriding ENTRYPOINT with mongod ... omitting --bind-ip and --bind-ip-all in compose.yaml.

No idea why I used entrypoint instead of command, but there I was, banging my head against the wall. It was fun though, crawling through all these posts of people desperate to connect to their database, throwing in --bind-ip-all, --connection=direct, publishing ports, without success. Or another post about this person getting their entire database contents replaced by a bitcoin ransom message because they had exposed 27017 to the outside world. I guess that's why mongo binds to localhost only by default...

What was relevant in my case, is that the embedded entrypoint (for Mongo 5.0 at least) adds --bind-ip-all if it cannot find any explicit mention of --bind-ip or --bind-ip-all in the command arguments (because, after all, if you are running in a container and you do not expose that port, what's the point). So, overriding the entrypoint means you have to explicitly add --bind-ip or --bind-ip-all to the new entrypoint.

My question is, I guess, are there other things this entrypoint does that we should be aware of? What do we miss if we set entrypoint: mongod --bind-ip-all --db-path ... --replSet rs01?

The entrypoint takes care of the initialization of the environment. It's not recommended to overwrite it.