How to install docker on Centos, AlmaLinux and Rocky Linux
Docker is a sophisticated platform for developers that allows them to package applications and their dependencies into containers, which are lightweight, portable, and self-contained environments. Developers can use Docker to provide a uniform development and deployment environment across different computers and operating systems, avoiding many of the challenges caused by changes in system setups and dependencies.
Docker offers substantial advantages in terms of scalability, resource utilization, and security, in addition to development benefits. Containers may be readily scaled up or down to meet the demands of the workload, allowing for better resource efficiency and cost savings. Docker also has strong security features, such as container isolation from the host system, making it a popular choice for executing mission-critical applications.
I have written more on docker and containers HERE.
Installing Docker on Linux is a straightforward process that can be done in a few simple steps.
NOTE: These steps were tested on AlmaLinux 9, and by convention they should work in CentOS Stream 9 and Rocky Linux 9. Additionally, it is possible for these steps to be applied to version 8.
-
- First, update your system.
# dnf update
- Install dnf-plugins-core package:
# dnf install -y dnf-plugins-core
- Remove the Podman package.
# dnf remove -y podman buidah
- Activate the Docker Repository:
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
- Now install Docker:
# dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Next, enable Docker service by running below commands:
# systemctl start docker # systemctl enable docker
- Verify the service is running:
# systemctl status docker
Verify docker version:
# docker --version
- Add a user to the docker group:
# usermod -aG docker username
- Finally, test your docker installation:
# docker run hello-world
That’s it, docker is installed.
Change username to appropriate user account.
- First, update your system.