boot2docker on windows – Can't access exposed port

I’ve installed boot2docker (full install) on Windows 7 and am trying to run the container port redirection demo:

docker run --rm -i -t -p 80:80 nginx

Which looks like it isn’t quite finishing properly, it just stops and looks like this:

  • Docker: Is it necessary to mount a new partition
  • Keep Data on Embedded database during deploy
  • Jenkins Declarative Pipeline - how to display Gatling results?
  • Difference between docker restart & docker-compose restart
  • How to link jenkins pipeline job to label on docker slaves containers
  • How to execute non-global npm binary in docker
  • enter image description here

    When I open another git bash shell and run boot2docker ip I get, and when I pop that in chrome I get Error code: ERR_CONNECTION_TIMED_OUT

    It works fine for me with plain docker on Ubuntu 14.04. What else do I need to do to make it work with boot2docker on windows?

  • running node.js in docker calling a shell script , gibberish errors
  • Move file downloaded in Dockerfile to harddrive
  • Apache/php return full php error track description
  • make[1]: [install-domserver-l] Error 1 (ignored)
  • Using Symfony in Docker Environment for Production
  • Docker-compose environment variables
  • 2 Solutions collect form web for “boot2docker on windows – Can't access exposed port”

    Looking more closely, my problem is the same as this question: Docker, can’t reach “rails server” development from localhost:3000 using docker flag -p 3000:3000

    The answer to that question that worked for me was this one, which simply says to run

    boot2docker ssh -L 8080:localhost:80

    at the terminal before starting boot2docker

    In my case I do this (from a git bash terminal):

    boot2docker init # from
    boot2docker up
    boot2docker ssh -L 8787:localhost:8787 # sets up port forwarding and starts boot2docker
    docker run -d -p 8787:8787 cboettig/rstudio # starts the container I want

    then go to my web browser in windows and point it to http://localhost:8787/ and I get a server instance of RStudio. When I’m done:

    docker rm -f $(docker ps -a -q) # delete all containers

    UPDATE: downgrading to an earlier version of VirtualBox will fix this

    After struggling with folder sharing I regressed through previous versions of VirtualBox and found that with version 4.3.12 I could enable folder sharing and have the port forwarded exactly according to the official instructions, that is I could access my docker container at So downgrading VirtualBox is another option for working around this problem.

    ANOTHER UPDATE: updating to the new release of v1.3.1 of boot2docker will fix this

    This release just came out a week ago and includes VirtualBox Guest Additions, which simplifies all of this. I now simply do

    boot2docker ssh # start boot2docker
    docker run -d -p 8787:8787 -v /c/Users/foobar:/home/rstudio/foobar rocker/rstudio  

    And I get everthing working as expected and can log into RStudio in my browser at http://localhost:8787/ (linux) or (Windows) and it just works.

    In this case I’ve also got folder sharing working with, /c/Users/foobar corresponding to an existing folder on my computer at C:/Users/foobar, and foobar can be anything. With this method I can read and write files both ways between Windows and RStudio and I don’t need to connect to a special IP address like the samba method does in the official docs

    I had this problem too after a couple of failed attempts to boot2docker start. This created multiple entries of host-only networks configured on VirtualBox (VirtualBox Host-Only Ethernet Adapter #2, VirtualBox Host-Only Ethernet Adapter #3), and probably the boot2docker’s VM was using a bad one.

    I cleaned up using Virtualbox standard UI, leaving only one of the networks and now everything works fine.

    I’m using boot2docker 1.5.0.

    Just to register something that happened to me, and made me lose a couple of hours.

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