Boot2docker on windows - Unable to access open port

I installed boot2docker (full install) on Windows 7 and trying to run a container port forwarding demo :

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

It doesn't seem to be quite finished, it just stops and looks like this:

enter image description here

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

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

+6
source share
2 answers

More carefully, my problem is the same as this question: Docker, cannot reach the development of "rails server" with localhost: 3000 using the dock flag -p 3000: 3000

The answer to this question that worked for me was this one that just says to run

 boot2docker ssh -L 8080:localhost:80 

on the terminal before running boot2docker

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

 boot2docker init # from https://github.com/boot2docker/boot2docker 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 windows web browser and point it to http://localhost:8787/ and I get an instance of the RStudio server. When I finished:

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

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

After struggling with folder sharing, I regressed with previous versions of VirtualBox and found that with version 4.3.12 I can enable folder sharing and redirect the port according to the official instructions, that is, I could access the docker container in 192.168.59.103 . Therefore, downgrading VirtualBox is another option to solve this problem.

OTHER UPDATE: updating to the new version v1.3.1 boot2docker will fix this

This release was released a week ago and includes add-ons for VirtualBox that simplify all this. Now i just do

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

And I get everything that was expected, and I can enter RStudio in my browser at http://localhost:8787/ (linux) or http://192.168.59.103:8787 (Windows) and it just works.

In this case, I also have shared access to the folder , working with /c/Users/foobar , corresponding to the existing folder on my computer, C:/Users/foobar and foobar can be anything. With this method, I can read and write files in both directions between Windows and RStudio, and I do not need to connect to a special IP address, for example, the samba method in official documents

+14
source

I had this problem also after several failed boot2docker start attempts. This created several host-only network entries configured on VirtualBox ( VirtualBox Host-Only Ethernet Adapter #2 , VirtualBox Host-Only Ethernet Adapter #3 ), and probably the boot disk VM2 used a bad one.

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

I am using boot2docker 1.5.0.

Just logging what happened to me and made me lose a couple of hours.

+1
source

Source: https://habr.com/ru/post/974525/


All Articles