Tamer Youssef

Just another site

By - Tamer

Installing Docker on AlmaLinux 8

Docker has revolutionized the way applications are deployed and run by utilizing containerization technology. In this guide, we will walk you through the step-by-step process of installing Docker on AlmaLinux 8, enabling you to create, deploy, and manage your applications efficiently and securely. Whether you’re a developer, system administrator, or IT professional, Docker can greatly simplify your workflow and enhance productivity.

Prerequisites
Before we dive into the installation process, let’s ensure that our system is up to date. Open your terminal and run the following command to check for any pending system updates:

yum update


Adding Docker Repository


To install Docker on AlmaLinux 8, we need to enable the Docker CE repository. Execute the following command to add the repository:

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


Installing Docker-ce Package


Once the repository is added, we can proceed with installing the Docker-ce package. Run the following command to install Docker-ce on AlmaLinux 8:

dnf -y install docker-ce –nobest


Enabling the Docker Service

After successfully installing Docker-ce, we need to enable the Docker service to ensure it starts automatically on system boot. Execute the following command to enable and start the Docker service:

systemctl enable –now docker


Verifying the Docker Service
To confirm that Docker is running properly, we can use the systemctl command to check the status of the Docker service:

systemctl status docker


If Docker is active and running, you should see an output similar to the following:

● docker.service – Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres>
Active: active (running) since Thu 2021-03-18 15:10:09 GMT; 25s ago
Docs: https://docs.docker.com
Main PID: 7649 (dockerd)
Tasks: 9
Memory: 44.3M
CGroup: /system.slice/docker.service
└─7649 /usr/bin/dockerd -H fd:// –containerd=/run/containerd/contai>
Congratulations! You have successfully installed and verified Docker on AlmaLinux 8. Now, let’s explore some common Docker commands and get started with containerizing your applications.

Common Docker Commands


Docker provides a robust command-line interface for managing containers and images. Here are some frequently used commands to help you get started:

  1. Pulling an Image
    To create a container, you need an image. Docker Hub is a popular registry that hosts a wide range of pre-built images. You can pull an image from Docker Hub using the docker pull command. For example, to pull the Ubuntu image, run the following command:

docker pull ubuntu

  1. Running a Container
    Once you have an image, you can create a container using the docker run command. For instance, to run a container from the Ubuntu image, execute the following command:

docker run -it ubuntu /bin/bash
This command starts an interactive session inside the container, allowing you to execute commands and explore the container’s environment.

  1. Listing Containers
    To view a list of running containers, use the docker ps command. This command displays information such as the container ID, image used, status, and more. Running the command without any options will show only the running containers. To view all containers, including the ones that are not currently running, add the -a flag:

docker ps -a

  1. Stopping a Container
    To stop a running container, you can use the docker stop command followed by the container ID or name. For example, to stop a container with the ID abcdef123456, run the following command:

docker stop abcdef123456

  1. Removing a Container
    If you no longer need a container, you can remove it using the docker rm command. This command accepts either the container ID or name as an argument. For instance, to remove a container with the ID abcdef123456, execute the following command:

docker rm abcdef123456

  1. Listing Images
    To view the list of Docker images available on your system, you can use the docker images command. This command displays information such as the image ID, repository, tag, and size.

docker images

  1. Removing an Image
    If you wish to remove an image from your system, use the docker rmi command followed by the image ID or name. For example, to remove an image with the ID abcdef123456, run the following command:

docker rmi abcdef123456
These are just a few fundamental commands to get you started with Docker. As you become more comfortable with Docker, you’ll discover numerous other commands and options to streamline your container workflow.

Conclusion


Congratulations! You have successfully installed Docker on AlmaLinux 8 and familiarized yourself with some essential Docker commands. With Docker, you can now create, deploy, and manage your applications in a lightweight and efficient manner. Whether you’re working on a small project or a large-scale production environment, Docker provides the tools you need to simplify the deployment process and improve scalability.

If you’re looking for reliable and scalable cloud hosting solutions, consider Shape.host. Shape.host offers Cloud VPS services with robust infrastructure and excellent customer support. With Shape.host, you can focus on your core business while leaving the technical aspects of hosting to the experts. Visit Shape.host today and experience the power of secure and efficient cloud hosting.