Rocky Enterprise Linux is a free, open-source Linux distribution system, and it’s based on RedHat source code as its upstream vendor. We can say that Rocky is a drop-in replacement for Red Hat Enterprise Linux for non-commercial Linux operating system. So, there are many compatibility in binary code, software, application between Rocky and Red Hat, which can use freely without spend the costs. It’s of course RedHat-based distros, just like CentOS, CloudLinux and AlmaLinux.
Today we will teach you on how to install and configure Docker Engine on Rocky Linux 8.5 (Green Obsidian) running under cheap cloud VPS on Digital Ocean. Docker as you can know is an free, open-source containerization platform for build, testing, developing and shipping running applications. It’s intended to deliver the applications or software more quickly rather than using traditional platform builder. So we can build, deploy, test the containerization application with Docker Engine.
Before installing Docker on your machine, make sure to meet the following requirenments.
PREREQUISITES:
* VPS, Cloud or Bare-Metal * Running under Rocky Linux 8.5 (Green Obsidian) * Server IPv4 Address with Superuser Privileges (Root Access) * Gnome Terminal for Linux Desktop * PuTTy SSH Client for Windows or Mac * Powershell for Windows 10/11
1.) Install Software Dependency
First of all, you need to install software dependency on your machine before moving to the next step. Don’t worry you can use yum or dnf command on dnf-based system.
$ dnf install -y yum-utils DigitalOcean Agent 92 kB/s | 3.3 kB 00:00 DigitalOcean Droplet Agent 37 kB/s | 3.3 kB 00:00 Package yum-utils-4.0.21-4.el8_5.noarch is already installed. Dependencies resolved. ===================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================== Upgrading: dnf noarch 4.7.0-8.el8 baseos 540 k dnf-data noarch 4.7.0-8.el8 baseos 154 k dnf-plugins-core noarch 4.0.21-11.el8 baseos 70 k json-c x86_64 0.13.1-3.el8 baseos 40 k libdnf x86_64 0.63.0-8.el8 baseos 704 k python3-dnf noarch 4.7.0-8.el8 baseos 544 k python3-dnf-plugins-core noarch 4.0.21-11.el8 baseos 239 k python3-hawkey x86_64 0.63.0-8.el8 baseos 115 k python3-libdnf x86_64 0.63.0-8.el8 baseos 777 k yum noarch 4.7.0-8.el8 baseos 205 k yum-utils noarch 4.0.21-11.el8 baseos 72 k Transaction Summary ===================================================================================================================================================== Upgrade 11 Packages Total download size: 3.4 M Downloading Packages:
2.) Add Docker CentOS Repository
Currently there is no available official repository with support Docker installation on Rocky Linux 8.5 (Green Obsidian). So we can use Docker CentOS repository to install Docker Engine on Rocky Linux 8.5 (Green Obsidian). Simply run the following command to add Docker CentOS repository.
$ yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
3.) Next, Install Docker on Rocky Linux 8.5
Then you can run the following command to install the latest stable release of Docker Engine and Containerd. You can use –allowerasing and –nobest options to minimize the conflicting software during Docker installations.
$ dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin --allowerasing --nobest DigitalOcean Agent 97 kB/s | 3.3 kB 00:00 Docker CE Stable - x86_64 292 kB/s | 25 kB 00:00 DigitalOcean Droplet Agent 62 kB/s | 3.3 kB 00:00 Dependencies resolved. ===================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================== Installing: containerd.io x86_64 1.6.4-3.1.el8 docker-ce-stable 33 M docker-ce x86_64 3:20.10.16-3.el8 docker-ce-stable 22 M docker-ce-cli x86_64 1:20.10.16-3.el8 docker-ce-stable 29 M docker-compose-plugin x86_64 2.5.0-3.el8 docker-ce-stable 7.0 M Installing dependencies: container-selinux noarch 2:2.179.1-1.module+el8.6.0+785+d1251653 appstream 57 k docker-ce-rootless-extras x86_64 20.10.16-3.el8 docker-ce-stable 4.7 M fuse-common x86_64 3.3.0-15.el8 baseos 21 k fuse-overlayfs x86_64 1.8.2-1.module+el8.6.0+785+d1251653 appstream 72 k fuse3 x86_64 3.3.0-15.el8 baseos 53 k fuse3-libs x86_64 3.3.0-15.el8 baseos 94 k libcgroup x86_64 0.41-19.el8 baseos 69 k libslirp x86_64 4.4.0-1.module+el8.6.0+785+d1251653 appstream 69 k slirp4netns x86_64 1.1.8-2.module+el8.6.0+785+d1251653 appstream 50 k Installing weak dependencies: docker-scan-plugin x86_64 0.17.0-3.el8 docker-ce-stable 3.8 M Enabling module streams: container-tools rhel8 Transaction Summary ===================================================================================================================================================== Install 14 Packages Total download size: 100 M Installed size: 415 M Is this ok [y/N]: y
Tehn verify the Docker version with the following command on your node server.
$ docker version Client: Docker Engine - Community Version: 20.10.16 API version: 1.41 Go version: go1.17.10 Git commit: aa7e414 Built: Thu May 12 09:17:20 2022 OS/Arch: linux/amd64 Context: default Experimental: true Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
4.) Grant Proper User and Groups Ownerships
To solve the above issues “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?” simply run the following command on your terminal. We will use 1000 and 1000 as user and group IDs on docker.sock file.
$ chown 1000:1000 /var/run/docker.sock
After that verify again the Docker version using below command.
$ docker version Client: Docker Engine - Community Version: 20.10.16 API version: 1.41 Go version: go1.17.10 Git commit: aa7e414 Built: Thu May 12 09:17:20 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.16 API version: 1.41 (minimum version 1.12) Go version: go1.17.10 Git commit: f756502 Built: Thu May 12 09:15:41 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.4 GitCommit: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16 runc: Version: 1.1.1 GitCommit: v1.1.1-0-g52de29d docker-init: Version: 0.19.0 GitCommit: de40ad0
5.) Manage Docker Services
There are some available command to manage Docker Services on Rocky Linux 8.5 (Green Obsidian, like start, stop, restart and check the Docker state services. Simply run the following commands:
Make sure Docker can start their engine since machine boot.
$ systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
To Start Docker Service
$ systemctl start docker
To Stop Docker Service
$ systemctl stop docker
To Restart Docker Service
$ systemctl restart docker
To Check Docker Engine Status
$ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2022-05-19 11:12:47 UTC; 6s ago Docs: https://docs.docker.com Main PID: 1147239 (dockerd) Tasks: 7 Memory: 27.8M CGroup: /system.slice/docker.service └─1147239 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.542339610Z" level=info msg="[graphdriver] using prior storage driver> May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.552665580Z" level=warning msg="Your kernel does not support cgroup b> May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.552706627Z" level=warning msg="Your kernel does not support cgroup b> May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.552989851Z" level=info msg="Loading containers: start." May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.816896724Z" level=info msg="Default bridge (docker0) is assigned wit> May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.929041140Z" level=info msg="Loading containers: done." May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.951467882Z" level=info msg="Docker daemon" commit=f756502 graphdrive> May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.951583332Z" level=info msg="Daemon has completed initialization" May 19 11:12:47 open-source.project systemd[1]: Started Docker Application Container Engine. May 19 11:12:47 open-source.project dockerd[1147239]: time="2022-05-19T11:12:47.988836160Z" level=info msg="API listen on /var/run/docker.sock" lines 1-20/20 (END)
CONCLUSION
You have successfully install and configure Docker Engine on Rocky Linux 8.5 (Green Obsidian). On the next step you can build, deploy, test, and shipping your code, application or software under Docker Engine. No matter what the platform you’re using, either it cheap VPS, cloud server or bare-metal.