Docker : install2019/05/10 |
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 official image [root@dlp ~]# docker pull fedora Using default tag: latest Trying to pull repository docker.io/library/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@0e7be7503d41 /]# docker run -it fedora /bin/bash [root@0e7be7503d41 /]# # Container's console
uname -a Linux 0e7be7503d41 5.0.10-300.fc30.x86_64 #1 SMP Tue Apr 30 16:22:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux [root@0e7be7503d41 /]# 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 -it fedora /bin/bash [root@c303d34d84f9 /]# [root@dlp ~]# # Ctrl+p, Ctrl+q
# show docker process [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c303d34d84f9 fedora "/bin/bash" 22 seconds ago Up 20 seconds modest_liskov # connect to container's session [root@dlp ~]# docker exec -it c303d34d84f9 /bin/bash [root@c303d34d84f9 /]# # just connected
# shutdown container's process from Host's console [root@dlp ~]# docker kill c303d34d84f9 [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |