-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-entrypoint.sh not using correct port for first startup #440
Comments
Similar to #437 |
Selecting a random port will just make the failure non-deterministic since it'd still be able to pick a used port; checking for a port would be subject to a race condition, since the shell script isn't opening the port, Fortunately, it looks like we can switch to only use the unix socket during the temporary init, but this will break users that are using |
There's a potential solution to this over in #443. 👀 |
Is there a clean solution to this problem? I have a scenario using |
The easiest solution in that case would be to skip our entrypoint entirely and perform your own initialization (if needed). |
Hello,
I'm trying to setup a mongo container in AWS ECS on Fargate.
As you may know, Fargate forces all the containers of the same "task" to map ports on localhost. Long story short, if you run a complex environment with plenty of containers, all of them must serve on different TCP/UDP ports.
So, now, let's imagine I want to have two mongo containers in the same task. I need to have those containers running in two different ports.
Easy, just add the
--port 1234
and--port 1235
to the "command" section of the docker-compose file.But unfortunately that's not enough.
When you start the container via docker-entrypoint.sh, the scripts temporarily starts the container on the default port for adding users and stuff.
In such a moment, the second container will find the port busy and fail.
As a workaround I currently do:
entrypoint: ["bash","-c","sed -i 's/27017/50040/' /usr/local/bin/docker-entrypoint.sh && /usr/local/bin/docker-entrypoint.sh --port 50040" ]
Clearly that's not a nice fix.
I propose, the docker-entrypoint.sh should randomly select the temporarily port, to minimise the probability of a conflict.
Even better would be to first check if the selected port is available, otherwise try with a different one.
Thanks!
The text was updated successfully, but these errors were encountered: