CentOS 7
Sponsored Link

Docker : Install
2015/01/10
 
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
[1] Install Docker.
[[email protected] ~]#
yum -y install docker
[[email protected] ~]#
systemctl start docker

[[email protected] ~]#
systemctl enable docker

[2] Download the official image and create a Container and output the words "Welcome to the Docker World" inside the Container.
# download a centos image

[[email protected] ~]#
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

[[email protected] ~]#
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.
[[email protected] ~]#
docker run -i -t centos /bin/bash

[[email protected] /]#    
# 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
[[email protected] /]#
exit

exit
[[email protected] ~]#    
# back
[4] If exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key.
[[email protected] ~]#
docker run -i -t centos /bin/bash

[[email protected] /]# [[email protected] ~]#    
# Ctrl+p, Ctrl+q key to back to Host's console
[[email protected] ~]#
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

[[email protected] ~]#
docker attach 64241ed538ed

[[email protected] /]#    
# connected
# shutdown container's process from Host's console

[[email protected] ~]#
docker kill 64241ed538ed

[[email protected] ~]#
docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES