How to Install Docker on AlmaLinux 9

To install Docker on AlmaLinux 9, enable Docker repository

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

To install docker, run

dnf install docker-ce

To start docker on boot, run

systemctl enable docker

To start docker

systemctl start docker

To verify if docker is working, run

docker run hello-world

Install older version of docker

First, remove the current docker version with the command

dnf remove docker-ce -y

To list all available docker versions, run

dnf list docker-ce --showduplicates | sort -r

To install an older version of docker, specify the version and –nobest option, for example

dnf install docker-ce docker-ce-3:25.0.5-1.el9 --nobest

If you do a “dnf upgrade”, docker-ce package will get upgraded to the new version. To prevent this from happening, you need to use DNF versionlock plugin

Install DNF versionlock plugin with the command:

dnf install python3-dnf-plugins-extras-versionlock

Add docker-ce to versionlock

dnf versionlock add docker-ce

To view all packages that are versionlocked, run

dnf versionlock list

If you ever want to upgrade the package docker-ce, delete it from versionlock with the command

dnf versionlock delete docker-ce

Back to Docker

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *