How To Install Docker in Rocky Linux 9.4
- 00:46 cat /etc/os-release
- 00:56 rpm -qa docker
- 01:00 dnf check-update
- 01:13 dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
- 01:24 dnf install docker-ce docker-ce-cli containerd.io
- 02:16 systemctl start docker
- 02:32 systemctl enable docker
- 02:44 systemctl status docker
- 02:56 docker container create -i -t --name mycontainer alpine
- 03:31 docker images
To Install Docker In Rocky Linux 9.4
Introduction
Docker has emerged as an essential tool for both development and operations teams, offering a platform to efficiently build, share, and run containerized applications. For professionals utilizing Rocky Linux 9.4, the installation of Docker can greatly enhance development and deployment workflows. This article will provide a comprehensive guide to the steps required for installing and utilizing Docker on Rocky Linux 9.4.
Procedure
Step1: Check the OS version in terminal by using following commands
[root@linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"
Step2: Check the package is installed or not in terminal
[root@linuxhelp ~]# rpm -q docker
package docker is not installed
Step3: Update the Linux server by using following commands
[root@linuxhelp ~]# dnf check-update
Last metadata expiration check: 0:05:54 ago on Wed 07 Aug 2024 03:00:55 PM EDT.
NetworkManager.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-adsl.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-bluetooth.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-config-server.noarch 1:1.46.0-13.el9_4 baseos
NetworkManager-libnm.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-team.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-tui.x86_64 1:1.46.0-13.el9_4 baseos
NetworkManager-wifi.x86_64 1:1.46.0-13.el9_4 baseos
Step4: Add the official Docker repository.
[root@linuxhelp ~]# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
Step5: Install Docker, which is composed of three packages by using following commands
[root@linuxhelp ~]# dnf install docker-ce docker-ce-cli containerd.io
Docker CE Stable - x86_64 226 kB/s | 53 kB 00:00
Dependencies resolved.
==============================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================
Installing:
containerd.io x86_64 1.7.19-3.1.el9 docker-ce-stable 43 M
docker-ce x86_64 3:27.1.1-1.el9 docker-ce-stable 27 M
docker-ce-cli x86_64 1:27.1.1-1.el9 docker-ce-stable 7.8 M
Installing weak dependencies:
docker-buildx-plugin x86_64 0.16.1-1.el9 docker-ce-stable 14 M
docker-ce-rootless-extras x86_64 27.1.1-1.el9 docker-ce-stable 4.0 M
docker-compose-plugin x86_64 2.29.1-1.el9 docker-ce-stable 13 M
Transaction Summary
==============================================================================================================================================================
Install 6 Packages
Total download size: 109 M
Installed size: 422 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): docker-buildx-plugin-0.16.1-1.el9.x86_64.rpm 17 MB/s | 14 MB 00:00
(2/6): docker-ce-27.1.1-1.el9.x86_64.rpm 20 MB/s | 27 MB 00:01
(3/6): containerd.io-1.7.19-3.1.el9.x86_64.rpm 25 MB/s | 43 MB 00:01
(4/6): docker-ce-cli-27.1.1-1.el9.x86_64.rpm 7.5 MB/s | 7.8 MB 00:01
(5/6): docker-ce-rootless-extras-27.1.1-1.el9.x86_64.rpm 7.1 MB/s | 4.0 MB 00:00
(6/6): docker-compose-plugin-2.29.1-1.el9.x86_64.rpm 28 MB/s | 13 MB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 48 MB/s | 109 MB 00:02
Docker CE Stable - x86_64 23 kB/s | 1.6 kB 00:00
Importing GPG key 0x621E9F35:
Step6: Start the Docker daemon process.
[root@linuxhelp ~]# systemctl start docker
Step7: Enable the Docker daemon:
[root@linuxhelp ~]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
Step8: Check the status in Docker Daemon by using following commands
[root@linuxhelp ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
Active: active (running) since Wed 2024-08-07 15:08:35 EDT; 22s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 8741 (dockerd)
Tasks: 9
Memory: 26.4M
CPU: 314ms
CGroup: /system.slice/docker.service
└─8741 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 07 15:08:31 linuxhelp systemd[1]: Starting Docker Application Container Engine...
Aug 07 15:08:31 linuxhelp dockerd[8741]: time="2024-08-07T15:08:31.726331641-04:00" level=info msg="Starting up"
Aug 07 15:08:31 linuxhelp dockerd[8741]: time="2024-08-07T15:08:31.814915507-04:00" level=info msg="Loading containers: start."
Aug 07 15:08:32 linuxhelp dockerd[8741]: time="2024-08-07T15:08:32.386490390-04:00" level=info msg="Firewalld: created docker-forwarding policy"
Step9: Create the image in container using docker command
root@linuxhelp ~]# docker container create -i -t --name mycontainer alpine
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
c6a83fedfae6: Pull complete
Digest: sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
Status: Downloaded newer image for alpine:latest
16ff2fec83e1deb9bedf3694c9de166db213822197dac4dfe866544a1432f5f0
Step10: List out the images by using following commands
[root@linuxhelp ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 324bc02ae123 2 weeks ago 7.8MB
[root@linuxhelp ~]#
Conclusion:
There’s a whole lot more to Docker than has been given in this article, but this should be enough to getting you started working with it on Rocky Linux 9. Like most open source projects, Docker is built from a fast-developing codebase.
Comments ( 0 )
No comments available