Docker : Install2025/08/07 |
|
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers. |
|
| [1] | Install Docker CE. |
|
[root@dlp ~]#
[root@dlp ~]# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/docker-ce.repo
[root@dlp ~]#
dnf --enablerepo=docker-ce-stable -y install docker-ce
[root@dlp ~]#
systemctl enable --now docker
[root@dlp ~]#
[root@dlp ~]# rpm -q docker-ce docker-ce-28.3.3-1.el10.x86_64 docker version Client: Docker Engine - Community Version: 28.3.3 API version: 1.51 Go version: go1.24.5 Git commit: 980b856 Built: Fri Jul 25 11:36:17 2025 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 28.3.3 API version: 1.51 (minimum version 1.24) Go version: go1.24.5 Git commit: bea959c Built: Fri Jul 25 11:33:31 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.27 GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da runc: Version: 1.2.5 GitCommit: v1.2.5-0-g59923ef docker-init: Version: 0.19.0 GitCommit: de40ad0 |
| [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 quay.io/centos/centos:stream10
stream10: Pulling from centos/centos 5e901762d568: Pull complete Digest: sha256:6fc587a47e7d92c4ece5c735cb34bdbdce54907c71fea2f0cc55eddb35bb374d Status: Downloaded newer image for quay.io/centos/centos:stream10 quay.io/centos/centos:stream10 # run echo inside Container [root@dlp ~]# docker run quay.io/centos/centos:stream10 /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 quay.io/centos/centos:stream10 /bin/bash [root@7173009cf9ca /]# # Container's console [root@7173009cf9ca /]# cat /etc/os-release NAME="CentOS Stream" VERSION="10 (Coughlan)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="10" PLATFORM_ID="platform:el10" PRETTY_NAME="CentOS Stream 10 (Coughlan)" ANSI_COLOR="0;31" LOGO="fedora-logo-icon" CPE_NAME="cpe:/o:centos:centos:10" HOME_URL="https://centos.org/" VENDOR_NAME="CentOS" VENDOR_URL="https://centos.org/" BUG_REPORT_URL="https://issues.redhat.com/" REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 10" REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"[root@7173009cf9ca /]# 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 quay.io/centos/centos:stream10 /bin/bash [root@b8abdf33218c /]# [root@dlp ~]# # Ctrl+p, Ctrl+q
# show docker processes [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 827a32452e96 quay.io/centos/centos:stream10 "/bin/bash" 7 seconds ago Up 6 seconds nostalgic_morse # connect to container's session [root@dlp ~]# docker attach 827a32452e96 [root@827a32452e96 /]# # shutdown container's process from Host's console [root@dlp ~]# docker kill 827a32452e96 827a32452e96 [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| Sponsored Link |
|
|