Docker inside Linux VM cannot connect to web application

My setup is the following:

Host: Win10
Guest: Ubuntu 15.10 (clean install, only docker and nodejs are added)
Base image: 1.0.0-beta8-coreclr

Inside the guest I have installed Docker and created image (added sample webapp using yeoman to the image above). When I run the image inside container I can ping the container IP sucessfuly using the container IP from the linux (e.g.

  • How to create a customizable environment that can be rapidly distributed to a local machine?
  • Cannot execute RUN mkdir in a Dockerfile
  • Spark app unable to write to elasticsearch cluster running in docker
  • Secure server with Fail2ban and Docker
  • Mixing cpu-shares and cpuset-cpus in Docker
  • How do I expose a docker container port to another container
  • $sudo docker run -d -p 80:5000 --name web myapp
    $sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' "web"
    PING ( 56(84) bytes of data.
    64 bytes from icmp_seq=1 ttl=64 time=0.060 ms
    1 packets transmitted, 1 received, 0% packet loss, time 999ms
    curl: (7) Failed to connect to port 80: Connection refused

    I can also connect to the container and execute commands like ping, however from the linux machine (guest in VirtualBox, host for docker) I cannot access the web app that is hosted inside the container as seen above. I tried several approaches like mapping to the host IP addresses etc, but none of them worked. Did anyone have ideas where to start from ? Is the issue comes from that the docker is installed inside VirtualBox machine?

    Thank you in advance.

    Edit: Here are the logs from the container:

    Could not open /etc/lsb_release. OS version will default to the empty string.
    Hosting environment: Production
    Now listening on: http://localhost:5000
    Application started. Press Ctrl+C to shut down.

  • Docker containers work on port 80 only
  • How to run uWSGI and NGINX in different Docker containers
  • How do I run puppet agent inside a docker container to build it out. How do I achieve this?
  • Accessing an Apache server in a Docker container using a hostname
  • How to restore a mongo Docker container on the Mac
  • Which one should i use? docker kill or docker stop?
  • One Solution collect form web for “Docker inside Linux VM cannot connect to web application”

    Your command tells Docker to essentially proxy requests from port 80 of the Linux guest to port 5000 of the container. So the curl command you tried doesn’t work because you’re trying on port 80 on the container, while the container itself has a service listening on port 5000.

    To connect to the container directly, you would use (on the Linux guest):


    To access via the published port on the Linux guest (from your host):

    curl (Linux guest IP)

    Or (from the Linux guest):

    curl localhost

    Edit: This will also prove to be problematic:

    Now listening on: http://localhost:5000

    You’ll want your app inside the container to bind to all interfaces ( so it listens on the container’s assigned IP. With localhost it won’t be accessible.

    You might find this example useful:

    This line specifies that the app bind to all interfaces (using “*”) on port 5004:

    21            "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5004"

    You’ll need similar configuration.

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