Created
August 21, 2015 17:54
-
-
Save anokun7/180346d8c4bf4a56d8f0 to your computer and use it in GitHub Desktop.
To expose a port on a running container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this on the docker host (of course) | |
# Here I am exposing port 8080 on the container whose IPAddress is 172.17.0.113 | |
#> as port 8888 on the docker host | |
# To get the container's IPAddress, use `docker inspect <containerid> | grep IPAddress | |
# To get the docker host's ip address and ssh into it, use: | |
# `docker-machine ssh $(docker-machine ls -q)` | |
iptables -t nat -A DOCKER -p tcp --dport 8888 -j DNAT --to-destination 172.17.0.113:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment