Trouble hitting a container's exposed port from a seperate container & host

I have two vagrant hosts running local on my machine and I am trying to hit a container within one host from a second container on the other host.

When I curl from within the container:

  • How to make a TCP outgoing connection with Docker container?
  • How to set Docker-compose arguments in console?
  • Docker WebLogic 11g container network issues after restart
  • Best practice to make root environmental variables visible to Apache under supervisord?
  • Meteor mupx ssl configuration is not working, still routing to port 80
  • OSX Play Framework Auto-Reload
  • curl search.mydomain.localhost:9090/ping
    

    I receive the curl: (7) Failed to connect to search.mydomain.localhost port 9090: Connection refused

    However when I curl without specifying the port:

    curl search.mydomain.localhost/ping
    OK
    

    I’m certain the port is properly exposed as if I try the same from within the host instead of within the container I get:

    curl search.mydomain.localhost:9090/ping
    OK
    

    Which shows that the service at port 9090 is exposed, however there is some networking issue with the container trying to reach it.

    A fellow dev running the same versions of vbox/vagrant/docker/docker-compose and using an identical commit of the repos has no trouble hitting the service from within the container. I’m really stumped as to what to try from here…

    I’m using the default bridge network:

    sudo brctl show
    bridge name bridge id       STP enabled interfaces
    docker0     8000.02427c9cea3c   no      veth5dc6655
                                vethd1867df
    
    docker network inspect bridge
    [
        {
            "Name": "bridge",
            "Id": "e4b8df614d4b8c451cd4a26c5dda09d22d77de934a4be457e1e93d82e5321a8b",
            "Scope": "local",
            "Driver": "bridge",
            "IPAM": {
                "Driver": "default",
                "Config": [
                    {
                        "Subnet": "172.17.0.1/16",
                        "Gateway": "172.17.0.1"
                    }
                ]
            },
            "Containers": {
                "1d67a1567ff698694b5f10ece8a62a7c2cdcfcc7fac6bc58599d5992def8df5a": {
                    "EndpointID": "4ac99ce582bfad1200d59977e6127998d940a688f4aaf4f3f1c6683d61e94f48",
                    "MacAddress": "02:42:ac:11:00:03",
                    "IPv4Address": "172.17.0.3/16",
                    "IPv6Address": ""
                },
                "3e8b6cbd89507814d66a026fd9fad26d649ecf211f1ebd72ed4689b21e781e2c": {
                    "EndpointID": "2776560da3848e661d919fcc24ad3ab80e00a0bf96673e9c1e0f2c1711d6c609",
                    "MacAddress": "02:42:ac:11:00:02",
                    "IPv4Address": "172.17.0.2/16",
                    "IPv6Address": ""
                }
            },
            "Options": {
                "com.docker.network.bridge.default_bridge": "true",
                "com.docker.network.bridge.enable_icc": "true",
                "com.docker.network.bridge.enable_ip_masquerade": "true",
                "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
                "com.docker.network.bridge.name": "docker0",
                "com.docker.network.driver.mtu": "1500"
            }
        }
    ]
    

    I’m on Docker version 1.9.0, build 76d6bc9 and docker-compose version: 1.5.0.

    Any help would be appreciated.

  • Java connecting to cassadra running inside docker
  • MESOS / MARATHON / DOCKER - Docker started is wrong & Port Forwarding
  • docker bind-mounting a managed volume
  • Docker. Does restart container means the same as restart process from CMD instruction?
  • Docker-compose throwing error
  • Container watches etcd leader vs container watches etcd cluster
  • One Solution collect form web for “Trouble hitting a container's exposed port from a seperate container & host”

    I resolved my issue which seems like it might be a bug. Essentially the container was inheriting the /etc/hosts from my local macbook, bypassing the /etc/hosts on the actual vagrant host running the container, causing my entry of “127.0.0.1 search.mydomain.localhost” to make all connection attempts within the container redirect to itself.

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