Preloader
Tel. 951986398 E-Mail roberto.aguirre@bksistemas.com

Instalar Docker

[1] Instalar Docker.
[root@dlp ~]# yum -y install docker

[root@dlp ~]# systemctl start docker

[root@dlp ~]# systemctl enable docker

[2] Download .
# download a centos image

[root@dlp ~]# docker pull centos

Trying to pull repository docker.io/library/centos ...
latest: Pulling from library/centos
47d44cb6f252: Extracting     32 B/32 B
...
...
# run echo inside Container

[root@dlp ~]# docker run centos /bin/echo «Welcome to the Docker World»

Welcome to the Docker World

[3] Connect to the interactive session of a Container with «i» and «t» option like follows. If exit from the Container session, the process of a Container finishes.
[root@dlp ~]# docker run -i -t centos /bin/bash

[root@06c8cbea8dc3 /]#     # Container’s console

bash-4.3#  uname -a

Linux 06c8cbea8dc3 3.10.0-123.13.2.el7.x86_64 #1 SMP Thu Dec 18 14:09:13 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@06c8cbea8dc3 /]#  exit

exit
[root@dlp ~]#   # back
[4] If exit from the Container session with keeping container’s process, push Ctrl+p, and Ctrl+q key.
[root@dlp ~]# docker run -i -t centos /bin/bash
[root@64241ed538ed /]#
[root@dlp ~]#

# Ctrl+p, Ctrl+q key to back to Host’s console

[root@dlp ~]# docker ps

# show docker process

CONTAINER ID   IMAGE      COMMAND       CREATED         STATUS         PORTS  NAMES
64241ed538ed   centos:7   "/bin/bash"   35 seconds ago  Up 34 seconds         clever_bartik

# connect to container’s session

[root@dlp ~]# docker attach 64241ed538ed
[root@64241ed538ed /]#

# connected
# shutdown container’s process from Host’s console

[root@dlp ~]# docker kill 64241ed538ed

[root@dlp ~]# docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES


Close

BKSistemas

Servicios IT