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 help our Customers to perform Docker related queries.
In this context, we shall look into how to install Docker CE on AlmaLinux OS 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
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.
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.
This article covers step by Step process to install Docker CE on AlmaLinux.
Docker is a tool that is used to run software in a container.
It's a great way for developers and users to worry less about compatibility with an operating system and dependencies because the contained software should run identically on any system.
To Install Docker on AlmaLinux:
1. We can add the Docker repository to our system with the following command.
$ sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
2. Before we begin installing Docker, we need to remove the podman and buildah packages from our system, as they conflict with Docker and will inhibit it from being installed.
$ sudo dnf remove podman buildah
3. Finally, we can install the three Docker packages we'll need by executing the following command.
$ sudo dnf install docker-ce docker-ce-cli containerd.io
4. Once installation is completed, start the Docker service and, optionally, enable it to run whenever the system is rebooted:
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service
5. You can verify that Docker is installed and gather some information about the current version by entering this command:
$ sudo docker version