×


Install Docker CE on AlmaLinux 8 - Step by Step Process ?

Docker is basically a container engine which uses the Linux Kernel in order to create the containers on top of an operating system. Which is use to create, deploy and run the applications

Basically, While Docker is an open-source containerization platform to run on Windows, Linux, and macOS, AlmaLinux OS is an open-source Linux distribution derived from the RHEL source.

Here at Ibmi Media, as part of our Server Management Services, we regularly perform related Docker queries.

In this context, we shall look into how to install Docker CE on AlmaLinux OS 8.


How to install Docker CE on AlmaLinux 8 ?

To perform this installation procedure, follow the steps outlined below.


1. Update AlmaLinux System

Initially, we need to update AlmaLinux System OS packages to the latest versions:

$ sudo dnf -y update

If we have kernel-related updates, we recommend performing a system restart:

$ sudo reboot


2. Add Docker CE repository

Before we install Docker CE we have to add an open Docker CE repository with rpm packages for Red Hat-based Linux systems.

We install yum-utils which provides the yum-config-manager command-line tool:

$ sudo dnf install -y yum-utils

Once done, we run the commands below to add Docker CE repository to the AlmaLinux OS 8 system:

$ sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

Then we confirm repository is available for use:

$ sudo dnf repolist
repo id
repo name
appstream AlmaLinux 8 – AppStream
baseos AlmaLinux 8 – BaseOS
docker-ce-stable Docker CE Stable – x86_64
epel Extra Packages for Enterprise Linux 8 – x86_64
epel-modular Extra Packages for Enterprise Linux Modular 8 – x86_64
extras AlmaLinux 8 – Extras
powertools AlmaLinux 8 – PowerTools


3. Install Docker CE on AlmaLinux 8

Now we can proceed to install Docker CE on AlmaLinux 8:

$ sudo dnf -y install docker-ce docker-ce-cli containerd.io

Once the installation command completes, we start the service:

$ sudo systemctl enable –now docker

Then we check the service 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 Wed 2021-04-21 12:38:02 EAT; 15s ago
Docs: https://docs.docker.com
Main PID: 73811 (dockerd)
Tasks: 11
Memory: 48.9M
CGroup: /system.slice/docker.service
└─73811 /usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock

Later we add a user to the docker group:

$ sudo usermod -aG docker $USER
newgrp docker

We can confirm if we are able to run any docker commands without Sudo:

$ docker –version
Docker version 20.10.6, build 370c289


4. Run docker container

We test our Docker CE installation on AlmaLinux 8 by pulling alpine Linux and hello-world images:

$ docker pull alpine:latest
latest: Pulling from library/alpine
540db60ca938: Pull complete
Digest: sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

We run a docker container from the alpine image:

$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
i. The Docker client contacted the Docker daemon.
ii. The Docker daemon pulled the “hello-world” image from the Docker Hub.
(amd64)
iii. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
iv. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/

This confirms our Docker installation on AlmaLinux OS 8 is working fine.


How to resolve common error encountered while installing Docker CE ?

Sometimes, We may come across the following error while restarting Docker:

Error starting daemon: Error initializing network controller: Error creating default “bridge” network: failed to parse pool request for address space “LocalDefault” pool “” subpool “”: could not find an available predefined network

This relates to the machine having several network cards. It can also happen in machines with VPN.

However, we can temporarily stop it, start docker and restart the VPN.

In addition, we can start docker manually:

/usr/bin/docker daemon –debug –bip=192.168.y.x/24

Here, the 192.168.y.x is the MAIN machine IP and /24 the ip netmask.

After starting, we can kill the docker and start as usual. 

However, if we clean the docker cache, we need to do this again.


[Need help with Docker installation on your Linux Server? We can help you. ]


Conclusion

This article covers the process of installing Docker CE on AlmaLinux. Docker is a popular virtualization platform for running applications in Containers.

It allows us to build and communicate containers with one on another.


To install Docker CE on AlmaLinux 8:

1. Add official Docker CE repository on your AlmaLinux 8, so that we can install it without downloading its packages manually.

$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

2. To let the system recognize the added Docker repository and the packages available in the same, run the system update that will force AlmaLinux to rebuild the system repo cache.

$ sudo dnf update

3. You can check the added repo including others of your system using the command.

$ sudo dnf repolist -v

4. Run the Command to Install Docker CE Engine.

$ sudo dnf install docker-ce docker-ce-cli containerd.io

5. Once the installation is completed, start the Docker service on your AlmaLinux and also enable it to run automatically with system boot.

$ sudo systemctl enable docker
$ sudo systemctl start docker

6. Check the Status of the Service to know it is working properly.

$ systemctl status docker