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.
In this context, we shall look into how to install Docker CE on AlmaLinux OS 8.
How to install Docker CE on AlmaLinux 8 ?
Here, you will see the steps to install Docker CE on AlmaLinux.
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
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
Main PID: 73811 (dockerd)
└─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
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
Status: Downloaded newer image for alpine:latest
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Status: Downloaded newer image for 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.
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:
For more examples and ideas, visit:
This confirms our Docker installation on AlmaLinux OS 8 is working fine.
How to fix common error while installing Docker CE on AlmaLinux 8 ?
Sometimes, you can encounter an error message such as this:
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
We may come across this error while restarting Docker.
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.