I am trying to make start learning docker with a simple gitweb example.
My problem is that the gitweb is not available on the local host.
Host: Mac OSX Sierra
docker search gitweb
docker pull fraoustin/gitweb
docker run -d --name gitweb fraoustin/gitweb
docker exec gitweb addauth test test
docker exec gitweb addrepos test
docker inspect gitweb
The Networks Setting tell me that the docker IP address is 172.17.0.2 (as expected).
When I open a browser now on the Host-Macbook and type in that IP address, that nothing happens.
What did I miss. I thought it would be as easy as this, to be honest.
How can I debug this?
Any help is very much appreciated.
You need a
-p option to expose some port to the host system, or you’ll be unable to reach it. Redirecting… has a reasonable example of this.
The Docker-internal IP addresses are pretty useless. On a Mac they’re impossible to reach, in either the “native” Docker for Mac or the VirtualBox-based Docker Machine/Docker Toolkit setup. Even when trying to communicate between containers, you should set up a private Docker network, in which case they can find each other by an internal DNS system.
(In my experience you rarely need to run
docker inspect at all, and the most useful bit of information I tend to find that way is whether a container was started with the set of environment variables I expect.)
That was a good kick in the right direction, thanks.
Starting gitweb with -p 80:80 made the docker image available under Mac. I just had to type localhost into the browser (or 127.0.0.1).
docker run -p 80:80 -d --name gitweb fraoustin/gitweb
Now I can start playing around with it.