Fedora 23
Sponsored Link

Docker : Access to Container Resource
2015/11/12
 
If you'd like to access to services like HTTP or SSH which is running in Containers as a daemon, configure like follows.
[1] 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"

[root@dlp ~]#
docker run -it -p 8081:80 my_image/centos_httpd /bin/bash
# start httpd and exit the Container

[root@f62d2bdc55cb /]#
/usr/sbin/httpd &

[root@f62d2bdc55cb /]#
echo "httpd on Docker Container" > /var/www/html/index.html

[root@f62d2bdc55cb /]#    
# Ctrl+p, Ctrl+q key to exit from Container
[root@dlp ~]#
docker ps

CONTAINER ID  IMAGE                 COMMAND       CREATED        STATUS         PORTS                   NAMES
f62d2bdc55cb  images/fedora_httpd   "/bin/bash"   32 seconds ago Up 30 seconds  0.0.0.0:8081->80/tcp sad_kalam
[2] Access to the URL via HTTP from a client which is in the same LAN with Container and make sure it's possible to access normally.
Matched Content
 
Tweet