Docker : Install2021/05/13 |
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-0ubuntu2 Built: Tue Mar 2 05:51:34 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-0ubuntu2 Built: Tue Mar 2 05:45:16 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.4-0ubuntu1 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 official image root@dlp:~# docker pull ubuntu
Using default tag: latest latest: Pulling from library/ubuntu 345e3491a907: Pull complete 57671312ef6f: Pull complete 5e9250ddb7d0: Pull complete Digest: sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93 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@b978f06ea24b:/# # Container's console root@b978f06ea24b:/# uname -a Linux b978f06ea24b 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux root@b978f06ea24b:/# 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@c19fff428bea:/# root@dlp:~# # Ctrl+p, Ctrl+q key
# show docker processes root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c19fff428bea ubuntu "/bin/bash" 17 seconds ago Up 16 seconds charming_carson # connect to container's session root@dlp:~# docker attach c19fff428bea root@c19fff428bea:/# # shutdown container's process from Host's console root@dlp:~# docker kill c19fff428bea c19fff428bea root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |