Tecnologia da Informação - TI : Docker : Access to the Container

Total de visualizações de página

Translate

quinta-feira, 14 de abril de 2016

Docker : Access to the Container


Docker : Access to the Container
2015/01/10
 
If you'd like to access to services like HTTP or SSH which is running in Containers as a daemon, set 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@821bc61cb2e6 /]# 
/usr/sbin/httpd & 

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

[root@821bc61cb2e6 /]# 
# exit with Ctrl+p, Ctrl+q
[root@dlp ~]# 
docker ps 

CONTAINER ID  IMAGE                        COMMAND      CREATED        STATUS        PORTS                  
821bc61cb2e6  my_image/centos_httpd:latest "/bin/bash"  54 seconds ago Up 53 seconds 0.0.0.0:8081->80/tcp
[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.

Nenhum comentário:

Postar um comentário

Chainalysis: empresa de inteligência em blockchain sofre ataque e expõe clientes

  A empresa de inteligência blockchain Chainalysis confirmou, nesta sexta-feira (6), que um ataque cibernético recente expôs nomes, identid...

Pesquisar este blog