Docker container cannot connect to host machine: No route to host

I’ve been trying to setup a docker environment using docker compose. One issue that has me stumped is that my docker containers cannot reach my host machine.

I setup a container using the following compose file:

  • Setting Docker Variables
  • What is the docker registry v2 API endpoint to get the digest for an image?
  • docker-compose up gives error: bash: sails: command not found
  • How to use Docker Remote API to assign a static IP address to a container
  • How to periodically run a script inside a fresh Docker container on Amazon AWS?
  • Docker command not available on Windows 7
  • version: '3'
        image: ...
          - "8080:8080"

    When I enter the container, I am able to ping my host machine:

    ping ${dockerHostIP}

    However when I try and retrieve the home page using curl inside the container:

    curl http://${dockerHostIP}:8080

    I get:

    curl: (7) Failed connect to ${dockerHostIP}:8080; No route to host

    I cannot figure out what should be done to resolve this No route to host error. Unfortunately I need to be able to do this as the web application makes requests using its hostname internally.

    Traceroute Results:

    traceroute ${dockerHostIP}
    traceroute to ${dockerHostIP} (${dockerHostIP}), 30 hops max, 60 byte packets
     1  ${dockerHostName} (${dockerHostIP})  0.039 ms !X  0.012 ms !X  0.007 ms !X

  • What is the created time in docker images command?
  • Access a docker container in docker multi-host network
  • Errors building two different projects with stack on the same machine
  • docker network connect to host second interface
  • How to run appium test using aluedeke/appium-android docker image?
  • How to deploy a self-building Docker image to make changes to itself in respect to the local environment?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.