How to Install Docker on AlmaLinux 9 Step-by-Step

In this guide, we will cover how to install docker on AlmaLinux 9 step-by-step.

Docker is a free and open-source containerization tool that enables enable developers to package their application into a container. Later that container image can be used to deploy and run application on public or private cloud.

Prerequisites

  • Minimal Installed AlmaLinux 9
  • 2 CPU/vCPU & 2GB RAM
  • 10 GB free disk space
  • Sudo User with Admin Rights
  • Internet connectivity

Without any further delay, let’s deep dive into docker installation steps.

1 ) Uninstall Podman and buildah

In case, podman and buildah is already installed on your AlmaLinux 9 then remove them using following command.

$ sudo dnf remove -y podman buidah

If these packages are not installed, then you can skip this step.

2) Enable Docker Repository

Docker package is not available in the default AlmaLinux 9 package repositories. So, enable Docker official repository by running following commands,

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

3) Install Docker with dnf Command

Run the beneath command to install latest docker from their official repository.

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

Output of above command,

Dnf-Install-Docker-AlmaLinux9

4) Start and Enable Docker Service

Once docker and its dependencies are installed then start and enable its service using beneath commands,

$ sudo systemctl start docker
$ sudo systemctl enable docker

Verify the docker service, run

$ sudo systemctl status docker

Docker-Service-Status-AlmaLinux9

Add your local user to the docker group so that user can run docker commands without sudo.

$ sudo usermod -aG docker $USER
$ newgrp docker

Execute following docker command to view docker version,

$ docker --version
Docker version 20.10.18, build b40c2f6
$

5) Test Docker Installation

To test docker installation, let’s spin a docker container using hello-world image.

$ docker run hello-world

Hello-World-Docker-Container-AlmaLinux9

Message from above docker container confirms that docker is working perfectly. This also confirms that docker installation is successful.

Remove Docker  

For any reason, if you wish to remove docker from your system then run following commands

$ sudo dnf remove -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd

That’s all from this guide. I hope you have successfully installed latest docker on AlmaLinux 9. Kindly post your queries and feedback in below comments section.

Also Read: 15 Quick Wget Command Examples in Linux

Leave a Comment

two + twenty =