Containers on docker network not resolving host name for inter container connections

Expected behavior

Expect two containers running on the same docker bridge network to be able to connect by container name.

ex. Rethinkdb container running with name of “rethinkdb” should be able to be accessed by another container on the same network by “rethinkdb:28015”

Actual behavior

The container attempting to connect to rethinkdb by container name is not able to connect.

Information

  • the output of:
    [OK] Moby booted
    [OK] driver.amd64-linux
    [OK] vmnetd
    [OK] osxfs
    [OK] db
    [OK] slirp
    [OK] menubar
    [OK] environment
    [OK] Docker
    [OK] VT-x
    Docker logs are being collected into /tmp/20160520-113215.tar.gz
    Most specific failure is: No error was detected
    Your unique id is: 61DE598E-1153-4376-B14D-A418C18864CB
    Please quote this in all correspondence.

Will work on a github repo to reproduce error and post shortly.

host distribution and version - OSX 10.10.4

Steps to reproduce the behavior

  1. Build two containers, run them on the same docker bridge network where one is trying to connect to the other (could be a database for instance, or could be making an http request to another)
1 Like

Here is an example project:

If you do a:

docker create network example
docker-compose up

You will see that the connection is not able to complete based on a container name.

I confirmed that the above project works as intended on Ubuntu.

l see the same issue with container names not being recognised

I have seen exactly the same behavior and am wondering why so few people are flagging this as an error. It is pretty fundamental, but this beta product is new. I have pretty much the same experience connecting to a mongo db and took the code to an AWS ubuntu machine and got it working.