In this tutorial, we will show you how to install Docker on AlmaLinux 8. For those of you who didn’t know, Docker is an open-source tool that makes creating and managing Linux containers (LXC) easy. With Docker, the applications reside inside the container on top of the Linux operating system. Docker uses Kernel features such as groups and namespace to allow the independent container to run on a single os instance.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Docker on an AlmaLinux 8.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 8, CentOS, or Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Docker on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release sudo dnf remove podman buildah
Step 2. Installing Docker on AlmaLinux 8.
Now we add official Docker CE repository on AlmaLinux:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Next, install the Docker-CE package on AlmaLinux 8 by running the following command:
sudo dnf install docker-ce docker-ce-cli containerd.io
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
You can verify that Docker is installed and some information about the current version using entering this command below:
sudo docker version
Step 3. Add AlmaLinux User to Docker User Group.
This next step is optional, but if you’d prefer the ability to run Docker as your current user, add your account to the docker group with this command:
sudo usermod -aG docker $USER
Check whether your user is in the docker group or not:
id$USER
You’ll need to reboot your system for those changes to take effect:
reboot
Step 4. Test Docker by pulling Image.
Now we download some Images such as Ubuntu to create a Container and test it, whether everything is working fine or not:
docker pull ubuntu
Once done, let’s create and run a container using it. The command for that is very simple:
docker run -it ubuntu
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing Docker on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Docker website.