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

  • Symfony2 app always has a 3 second wait between kernel.request and kernel.controller
  • Most appropriate container for a data only container?
  • Docker Error when Starting an Image
  • Managing remote docker machines from multiple development machines
  • Is it possible to show the `WORKDIR` when building a docker image?
  • In docker,how to close the port expose by dockerfile?
  • 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.

  • unable to import large database to docker mysql container
  • user: Current not implemented on linux/amd64 with golang using docker scrtach
  • How to connect to remote docker running on Ubuntu host
  • Should we install a docker image from Docker Hub at the begining?
  • Docker data volume and permission
  • How to use stdin, stdout and stderr streams after attaching to a container using Docker api?
  • 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 192.168.99.100, then you can reach your running docker container and it’s exposed port like this: 192.168.99.100:8080.

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