CentOS 6
Sponsored Link

Docker : Install2014/03/13

 
Install Docker which is the LXC (Linux Containers) based Container Tool.
[1] Install Docker.
# install from EPEL

[root@dlp ~]#
yum --enablerepo=epel -y install docker-io
[root@dlp ~]#
/etc/rc.d/init.d/docker start

Starting cgconfig service:            [  OK  ]
Starting docker:                      [  OK  ]
[root@dlp ~]#
chkconfig docker on

[2] Download an official image and create a Container and also output the words "Welcome to the Docker World" from the Container.
[root@dlp ~]#
docker run centos /bin/echo "Welcome to the Docker World"

Unable to find image 'centos' locally
Pulling repository centos
539c0211cd76: Download complete
Welcome to the Docker World
# just executed
[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 finishs.
[root@dlp ~]#
docker run -i -t centos /bin/bash

[root@dbc598a44dc1 /]#
# just connected
bash-4.1#
uname -a

inux dbc598a44dc1 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@dbc598a44dc1 /]#
exit

exit
[root@dlp ~]#
# be back
[4] If you'd like to 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@9e0fec01611f /]# [root@dlp ~]#
# Ctrl+p, Ctrl+q to be back to Host's console
[root@dlp ~]#
docker ps
# show docker process

CONTAINER ID   IMAGE       COMMAND         CREATED             STATUS           PORTS   NAMES
9e0fec01611f   centos:7    "/bin/bash"     36 seconds ago      Up 34 seconds            sad_yonath

# connect to container's session

[root@dlp ~]#
docker attach 9e0fec01611f

[root@9e0fec01611f /]#
# connected
# shutdown container's process from Host's console

[root@dlp ~]#
docker kill 9e0fec01611f

[root@dlp ~]#
docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES
Matched Content