-
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
/etc/hosts not consistently populated when using --x-networking #2445
Comments
This sounds like it might be a docker issue? The docker engine is what is responsible for creating the |
Thanks for confirming that the /etc/hosts is delegated to docker. I'll open the issue there. |
@dnephin @kenjones-cisco have closed the docker issue with the following comment : moby/moby#18174 (comment). |
I think I see what's happening now. The entrypoint for the script assumes that the entry already exists in I think the entrypoint script needs to poll and wait for the There has been some discussion in #686 about maybe adding support for some ordering with |
I originally had consul1 as the intended leader but the compose kept starting them up in reverse order (consul3, consul2, consul1), so I made consul3 the expected leader. But on Docker Engine v1.9.0, it works every time without fail but on Docker Engine v1.9.1 consul1 and consul2 will die with the provided error. Interestingly enough, with consul3 already running, if I ran As to the ordering, if nothing else a priority key to identify which ones should be started in a particular order. The links option probably enforced a natural ordering but without that each container would need logic to keep retrying, versus a way to indicate that containerX is a higher priority than containerY such that they are sorted to start using the priority. |
I've had similar issues with the order in which services get started (even without --x-networking) and am using this script in my entrypoints as a workaround for now. |
In my case, host names in /etc/hosts show as: container-name and container-name.project-name.
I want this entry, simply the service-name or the services's hostname: When I start containers without compose, individually with docker, I have control on this entry. Why not with compose? |
With docker you can only set it to the container name, which is what is happening here as well. See #2312 and moby/libnetwork#737 for the work in progress to add alias support |
OS:
docker-compose.yml
When using the command:
On Docker Engine 1.9.0 it successfully starts and connect to each other each time.
On Docker Engine 1.9.1 only consul3 starts successfully, the other two consul1, consul2 both fail because consul3 is unknown. Using docker inspect to identify where the hosts file is located, the file is missing any entries for the other containers.
I had started with
progrium/consul
before I switched over to my own images, but even if you use that image and pass in all the configurations as part of the command the same behavior can be seen using that image.The text was updated successfully, but these errors were encountered: