Docker containers cannot connect through overlay networks

I’ve got multiple hosts running Docker, I use Consul as the key-value store. I am able to create overlay networks, containers can see each other’s hostname and IP, /etc/hosts is nicely updated when containers are created/destroyed. However, the containers that are on different hosts can’t actually connect to each other (the ones on the same host can).

I’ve kept investigating logs, and Docker daemon logs contain these:

  • How to host multiple dockerized websites (ngnix) in one ip address?
  • MongoDB best practice setup
  • Go shared libraries for Docker containers to share
  • Connect to a VNC inside a docker which is on remote server
  • Cannot pipe docker pid to bash command
  • docker-compose volumes don't contain latest static code from image
  • [INFO] serf: EventMemberJoin: vagrant-ubuntu-trusty-64 192.168.57.103
    
    [ERR] memberlist: Conflicting address for vagrant-ubuntu-trusty-64. Mine: 192.168.57.103:7946 Theirs: 192.168.57.102:7946
    
    [ERR] serf: Node name conflicts with another node at 192.168.57.102:7946. Names must be unique! (Resolution enabled: true)
    

    Should the Docker daemons identify themselves somehow? It looks that Serf is confused because each daemon just uses the hostname as identifier.

  • Is there a best practice for where to log when running multiple instances of an application with Docker?
  • How do you run an .exe file on Docker?
  • Express does not run on docker, but on localhost
  • Connection Refused Docker Run
  • Docker-compose re-write file for version 2 to version 1
  • Change Docker machine location - Windows
  • 2 Solutions collect form web for “Docker containers cannot connect through overlay networks”

    Answer: cluster members need to have unique hostnames, because Docker daemons are identified base on the hostname (by default). Why on Earth did Docker leave this out from their tutorials?

    Check hostname for the machines on which docker is running. To check hostname run this on terminal.

    hostname
    

    It should be different for all nodes.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.