I was trying to expose a port from the Docker container on which my server is running to my Mac host so that my browser on the host can access it.
I could use
run -it -p <port>:<port> ...
If you're using Docker Toolbox, you need to make sure to get the right Docker machine IP address.
docker run -d -p 8080:80 --name webserver nginx
Find the right IP with
docker-machine ip. You might get
Then you can check it by open web browser at
http://192.168.99.100:8080/ with out proxy.
If you're using Docker for Mac, please read this docs.