Docker : Install2017/12/21 |
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
|
|
[1] | Install Docker. |
[root@dlp ~]#
[root@dlp ~]# dnf -y install docker
systemctl start docker [root@dlp ~]# systemctl enable docker |
[2] | Download an official image and create a Container and output the words [Welcome to the Docker World] inside the Container. |
# download the image [root@dlp ~]# docker pull fedora Using default tag: latest Trying to pull repository registry.fedoraproject.org/fedora ..... ..... # run echo inside Container [root@dlp ~]# docker run fedora /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 ~]#
[root@ce94d76e7283 /]# docker run -i -t fedora /bin/bash [root@ce94d76e7283 /]# # Container's console
uname -a Linux ce94d76e7283 4.14.3-300.fc27.x86_64 #1 SMP Mon Dec 4 17:18:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux [root@ce94d76e7283 /]# exit exit [root@dlp ~]# # come 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 fedora /bin/bash [root@368b6f803394 /]# [root@dlp ~]# # Ctrl+p, Ctrl+q
# show docker process [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 368b6f803394 fedora "/bin/bash" 31 seconds ago Up 30 seconds peaceful_khorana # connect to container's session [root@dlp ~]# docker exec -it 368b6f803394 /bin/bash [root@368b6f803394 /]# # connected
# shutdown container's process from Host's console [root@dlp ~]# docker kill 368b6f803394 [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |