We have covered the installation steps for setting up Docker packages on Almalinux 9 using the command terminal in this tutorial.
Almalinux 9 is the latest server Linux distro based on RedHat code. We can easily configure Docker on Almalinux 9 to run container service. Container service is slightly different than our regular VirtualBox or Vmware Desktop Virtualization.
In Docker, the OS images are lightweight, hence easy to install and consume fewer resources. Further, they run virtual containers at native speed. Many cloud services offer Alamlinux, hence let’s know how to use it for working with Docker Containers.
Add Docker Repository
Just like the previous version of Almalinux 8, the 9 also not offers Docker’s latest packages to install. So, we manually run the given command to enable the Docker repository on Almalinux 9.
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Perform system update
Execute the given command to update the system and its DNF package manager cache.
sudo dnf update
Docker installation on Almalinux 9
Once the system is ready, we can execute the main installation command to configure Docker CE on Almalinux 9. This will install the dependencies and extra packages we required to run this open-source container service on RHEL-based Linux systems.
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Start Docker Service
Next, we start and enable the Docker service and after that, we will go through a command that will let’s know whether it is working fine without any errors or not.
sudo systemctl enable --now docker
To check the service status:
sudo systemctl status docker
![start and enable docker service start and enable docker service on Almalinux 9](https://www.how2shout.com/linux/wp-content/uploads/2022/12/start-and-enable-docker-service.png)
Add non-root user to docker group
By default to run the Docker command, we need to use the sudo every time with it. To remove it, we can add our current user to the Docker group. After that, we can run the Docker command tool to create containers without the sudo rights.
sudo usermod -aG docker $USER
newgrp docker
Test Docker using Hell-World Image
We have already completed all the steps required to set up and configure the Docker on AlmaLinux 9. Now, let’s test our Docker command line to confirm it is working and creating containers without producing any common errors.
docker run hello-world
If the output of the above command contains this text:
Hello from Docker! This message shows that your installation appears to be working correctly.
Then your installation is correct and you want to create docker containers.
Uninstall Docker
Later after completing your testing or project, if you don’t require the container service then you can remove the Docker any time by running the given 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
FAQ
How to install Docker on RockyLinux?
The given steps in the tutorial can also be used to install Docker in Rocky Linux such as:
- Add Docker repository
- Install Docker Packages
- Enable its service
- Remove sudo usage
- Run Hello-World Image
Can I install the Docker engine without Desktop?
Yes, we can install and execute the Docker engine without its Desktop app that provides the graphical user interface.
Is Docker hub still free?
Docker Hub is a free repository to offer pre-built images for individual and non-commercial purposes. Anyone who has this container service on Windows, Linux, or macOS can use the pull
command to fetch images from Docker Hub.
Is Podman better than Docker?
Podman is better than Docker if you are planning to use Kubernetes and are also concerned more about security. Further Podman is also a daemon less container service which gives it also an upper hand.
Related Articles: