Port mapping in Docker on Mac OSX installed with Docker Toolbox

I installed Docker on a Mac using the Docker Toolbox.

I opened Docker Quickstart Terminal and ran

  • DNS settings don't work in Docker CE
  • Gitlab-ci configure docker runner for deployment with SSH keys
  • docker run --ulimit cpu=10 does not kill java process after timeout
  • Magento2 Docker Devbox Exception
  • Build container found dead before completing the build. Build container died because it was out of memory, or the Docker image was missing glibc
  • Java app in Docker container does not log to syslog properly
  • docker run hello-world

    That works fine.

    Then I tried:

    docker run -d -p 8080:80 nginx

    I can see that the container is added. docker log with the container id returns nothing but I think that’s normal?

    When I browse to localhost:8080 with chrome I don’t see the nginx welcome page. I’ve tried running a few different containers that are supposed to serve traffic but none of them have worked. The existing github issues and SO questions all seem to be talking about things which don’t exist anymore – or at least are not default on Mac OSX.

  • Service inside docker container stops after some time
  • docker-compose dev/live containers with different packages
  • Headless browser capable of popup handling?
  • Kubernetes: Multiple Services/Replication Controllers
  • I can't start the docker service with iptables error
  • Pulling of docker image from a registry fails
  • One Solution collect form web for “Port mapping in Docker on Mac OSX installed with Docker Toolbox”

    localhost is not the host where your docker is running. You need to go to the IP address of your running docker daemon.

    To find the IP address for your docker machine, run the command:

    docker-machine ip default

    where default is the name of your VM (as is the case I think for most installations).

    If that command returned something like, then you can reach your running docker container and it’s exposed port like this:

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