Docker on Mac: Unable to View Ports

I am running boot2docker on Yosemite. I have no problem creating containers and using them in boot2docker. I can also successfully connect via http to the docker daemon running in boot2docker vm. However, when I create a container with Revel and launch Revel, I cannot connect to Revel port 9000 from my browser.

I followed this approach: http://www.medding.me/blog/2014/09/06/setting-up-a-docker-environment-for-golang-development-part-1/

Here's the Revel server running:

INFO  2015/05/07 20:19:00 revel.go:329: Loaded module static
INFO  2015/05/07 20:19:00 revel.go:329: Loaded module testrunner
INFO  2015/05/07 20:19:00 revel.go:206: Initialized Revel v0.12.0 (2015-03-25) for >= go1.3
INFO  2015/05/07 20:19:00 run.go:57: Running revel3 (alexed1/revel3) in dev mode
INFO  2015/05/07 20:19:00 harness.go:165: Listening on :9000

      

When I connect to 192.168.59.103:9000 using a browser I get ERR_CONNECTION_REFUSED

.

I've tried a couple of different things:

As you can see, no port information is displayed on the running container:

+3


source to share


1 answer


EXPOSE

not for "exposing" ports to the host, for connecting containers, see docs .

As stated in jm _____ , you need to forward the container port to your host boot2docker

:

docker run -p 40001:9000 the/image/name

      

and then access it:



open http://192.168.59.103:40001

      

or by looking for port s docker ps

as you have tried.

PS: Not PORT

in Dockerfile

, but you can specify it in the file docker-compose.yml

.

+2


source







All Articles