Docker : Access to the containers2015/01/03
If you'd like to access to services like HTTP or SSH which is running in Containers as a daemon, set like follows.
|||For exmaple, use a Container which has httpd.|
# start the Container and connect to the shell session
# map the port of Host and the port of Container with "-p xxx:xxx"
docker run -it -p 8081:80 my_image/fedora_httpd /bin/bash
# start httpd & create a test page and exit from the Container
echo "httpd on Docker Container" > /var/www/html/index.html
# Ctrl+p, Ctrl+q key
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 189ec889fd6e my_image/fedora_httpd:latest "/bin/bash" 5 minutes ago Up 4 minutes 0.0.0.0:8081->80/tcp
|||Access to the test page with HTTP from a computer which is in the same network with container and make sure it is normally shown.|