Docker : Install2020/06/02 |
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:~# apt -y install docker.io docker version Client: Version: 20.10.2 API version: 1.41 Go version: go1.13.8 Git commit: 20.10.2-0ubuntu1~20.04.2 Built: Tue Mar 30 21:24:57 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Engine: Version: 20.10.2 API version: 1.41 (minimum version 1.12) Go version: go1.13.8 Git commit: 20.10.2-0ubuntu1~20.04.2 Built: Mon Mar 29 19:10:09 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.3.3-0ubuntu2.3 GitCommit: runc: Version: spec: 1.0.2-dev GitCommit: docker-init: Version: 0.19.0 GitCommit: |
[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 ubuntu
Using default tag: latest latest: Pulling from library/ubuntu ..... ..... Status: Downloaded newer image for ubuntu:latest docker.io/library/ubuntu:latest # run echo inside Container root@dlp:~# docker run ubuntu /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 -it ubuntu /bin/bash root@0c80f908e41e:/# # Container's console root@0c80f908e41e:/# uname -a Linux 0c80f908e41e 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux root@0c80f908e41e:/# 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 ubuntu /bin/bash root@3883a5e11c57:/# root@dlp:~# # Ctrl+p, Ctrl+q
# show docker process root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3883a5e11c57 ubuntu "/bin/bash" 19 seconds ago Up 18 seconds youthful_chaplygin # connect to container's session root@dlp:~# docker attach 3883a5e11c57 root@3883a5e11c57:/# # shutdown container's process from Host's console root@dlp:~# docker kill 3883a5e11c57 3883a5e11c57 root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |