Docker Community Forums

Share and learn in the Docker community.

Can't access service containers on startup

(Irphunky) #1

So i’ve been having a problem with my current docker-swarm setup on my mac. I’m running docker in swarm mode and have a local service that runs a number of containers.

On initial startup of my mac I can see the containers are running via docker service ls and can exec command on individual containers, however I access some of these containers via a nginx container that is resolving to the container names.

For example I have {container_name}.localhost which hits the nginx container and directs the request to container_name container.

However on initial start-up this does not work and I have to restart docker-for-mac for it to run, i’ve attempted to stop docker launching on start-up to see if it was a timing thing - but it still occurs.

Any idea what this could be?! I’m guessing it must be the nginx container and maybe its ability to resolve to the localhost?!