Docker : Install2021/08/30 |
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.5+dfsg1 API version: 1.41 Go version: go1.15.9 Git commit: 55c4c88 Built: Wed Aug 4 19:55:57 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Engine: Version: 20.10.5+dfsg1 API version: 1.41 (minimum version 1.12) Go version: go1.15.9 Git commit: 363e9a8 Built: Wed Aug 4 19:55:57 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.5~ds1 GitCommit: 1.4.5~ds1-2 runc: Version: 1.0.0~rc93+ds1 GitCommit: 1.0.0~rc93+ds1-5+b2 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 official image root@dlp:~# docker pull debian
Using default tag: latest latest: Pulling from library/debian 4c25b3090c26: Pull complete Digest: sha256:38988bd08d1a5534ae90bea146e199e2b7a8fca334e9a7afe5297a7c919e96ea Status: Downloaded newer image for debian:latest docker.io/library/debian:latest # run echo inside Container root@dlp:~# docker run debian /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 debian /bin/bash root@ba4533419177:/# # Container's console root@ba4533419177:/# uname -a Linux ba4533419177 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux root@ba4533419177:/# 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 debian /bin/bash root@dac89ef4566a:/# root@dlp:~# # Ctrl+p, Ctrl+q key
# show docker processes root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES dac89ef4566a debian "/bin/bash" 18 seconds ago Up 17 seconds objective_brahmagupta # connect to container's session root@dlp:~# docker attach dac89ef4566a root@dac89ef4566a:/# # shutdown container's process from Host's console root@dlp:~# docker kill dac89ef4566a dac89ef4566a root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |