install docker ce on almalinux

How to Install Docker CE on AlmaLinux

Docker Community Edition (CE) is a free, open-source, and community-supported version of the Docker platform. Docker CE provides all the essential features to build, ship, and run container applications. It is designed for developers who are just starting out with containerization, as well as for small-scale development and testing environments.

Docker CE includes the Docker Engine, a lightweight runtime and packaging tool, and Docker CLI, a command-line interface for interacting with the Docker Engine. With Docker CE, developers can quickly build, package, and deploy their applications as containers, making it easier to run the same application across multiple environments, such as development, testing, and production.

In the following tutorial, we will show you how to install Docker CE on AlmaLinux server.

Step 1: Log in to the Server & Update the Server OS Packages

First, log in to your AlmaLinux  server via SSH as the root user:

# ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the admin account username if necessary.

Before starting, you have to make sure that all AlmaLinux packages installed on the server are up to date. You can do this by running the following command:

# dnf update

Step 2. Install Docker CE and Docker Compose

By default, the latest Docker CE package is unavailable in the AlmaLinux default repository, so you must add the Docker CE official repository to your server.

To add a Docker CE repository to your AlmaLinux system, run the following command:

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

Update the package index by running the following command:

# dnf update

You can check the added repo, including others of your system, using the command:

# dnf repolist -v

Now that the Docker repository has been added to your system, you can continue to install Docker CE:

# dnf install docker-ce docker-ce-cli containerd.io

Once Docker is installed, verify the installed version with the following command:

# docker --version

You should get the following output:

Docker version 23.0.1, build a5ee5b1

Start the Docker CE service by running the following command:

# systemctl start docker

Enable the Docker service to start automatically at boot time by running the following command:

# systemctl enable docker

Verify the service is up and running with the following command:

# systemctl status docker

You should see a similar output with information about Docker being active:

● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2023-02-17 15:36:29 CET; 1min 9s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 49178 (dockerd)
      Tasks: 7
     Memory: 30.6M
        CPU: 160ms
     CGroup: /system.slice/docker.service
             └─49178 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Step 3. Run Docker without root

This step is optional, but if you prefer the ability to run Docker as your current user, add your account to the docker group with this command:

# usermod -aG docker $USER

You need to reboot your system for those changes to take effect.

# reboot

Step 4. Running Docker Containers

Now that you have installed Docker CE on AlmaLinux and set up your user account to run Docker commands, you can run Docker containers.

To run a Docker container, you need to have a Docker image. A Docker image is a pre-built environment for running an application.

Run the following command to pull a Docker image from the Docker Hub repository:

# docker pull hello-world

Note: Replace “hello-world” with the name of the Docker image you want to pull.

Run the following command to start a Docker container:

# docker run -it hello-world

The output should be similar to this:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

You can see your locally available images by using the docker images command.

# docker images

If you want to see the container information, you can use the following command:

# docker ps -a

The output should be similar to this:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
519a0de94621 hello-world "/hello" 7 minutes ago Exited (0) 7 minutes ago gracious_hamilton

In this tutorial, we learned how to install Docker CE on your AlmaLinux server and the basics of using it.

Of course, you don’t have to spend your time and follow this article to install Docker CE on AlmaLinux if you have an active AlmaLinux VPS Hosting service with us, in which case you can ask our expert Linux admins to install Docker CE for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post about installing Docker CE on AlmaLinux, please share it with your friends on social networks or leave a reply below.

Leave a Reply

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