-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
New Networking wont resolve hostnames in time #2614
Comments
That's right, with the new networking there is no longer any guarantee about the order containers are started. |
@dnephin any workarounds besides upping them separately? |
This is still being discussed extensively in #374. There are a lot of difficulties with trying to implement a general solution to the problem, but it seems to mainly come down to: what constitutes a container being up, given that when the entrypoint command exits, the container is stopped? In the meantime, I've been working around the problem by using a Bash script with a long-enough |
For anyone that might end up here, here is a ansible way to circunvent this problem. - name: Check if alfa and beta are up
shell: /usr/bin/docker ps | grep "{{ project_name }}" | awk '{print $NF}' | xargs
register: both_running
until: '"alfa" in "{{both_running.stdout}}" and "beta" in "{{both_running.stdout}}"'
retries: 10
delay: 10
- fail: msg="Something bad happened!"
when: '"alfa" not in "{{both_running.stdout}}" or "beta" not in "{{both_running.stdout}}"' |
I've created #2682 to track the issue of startup order, however I don't think that fully resolves the issue as discussed in #374. Best practice is for the application to not assume that all the dependencies are available when it starts, and to retry any unavailable connections on every request. Unfortunately nginx doesn't really do this, so it requires some additional scripting to wait for dependencies before nginx start. Since we already have issues tracking this, I'm going to close this one. |
Hi guys,
I have been using the -link option without any problems, until I got the time to carefully read the docs and realized that this a deprecated solution. So a decided to update one of my apps to the new networking system. My compose file contains 1 nginx and 2 webapp containers (alfa and beta that I use to deploy with minimum downtime using Ansible).
But when I run
docker-compose up
, NGINX thorows:But if I run afterwards
and I can also up the NGINX container separately later too
The text was updated successfully, but these errors were encountered: