0% found this document useful (0 votes)
36 views8 pages

How To Install and Use Docker On AlmaLinux 8 - VITUX

This document provides a step-by-step guide on how to install and use Docker on AlmaLinux 8, highlighting its benefits for developers and system administrators. It covers prerequisites, system updates, adding the Docker CE repository, installation, user permissions, and testing the installation with a sample container. The tutorial concludes by emphasizing Docker's utility in creating isolated development environments without impacting the host system.

Uploaded by

rlarrosa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views8 pages

How To Install and Use Docker On AlmaLinux 8 - VITUX

This document provides a step-by-step guide on how to install and use Docker on AlmaLinux 8, highlighting its benefits for developers and system administrators. It covers prerequisites, system updates, adding the Docker CE repository, installation, user permissions, and testing the installation with a sample container. The tutorial concludes by emphasizing Docker's utility in creating isolated development environments without impacting the host system.

Uploaded by

rlarrosa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

VITUX Home Linux CentOS Debian Ubuntu Shell


Linux Compendium

How to Install and Use Docker on AlmaLinux 8

Docker is a powerful platform for developers and sysadmins Search


that simplifies the process of deploying applications inside
software containers. Containers allow you to package up an Search 
application with all its parts (code, runtime, system tools, system
libraries – anything that would usually go in /usr/bin, or /usr/lib)
so it will run consistently on any Linux machine. This includes the About This Site
operating system kernel and other shared resources such as
memory and disk space. Docker provides a portable Vitux.com aims to become a Linux
environment for both development and production environments. compendium with lots of unique and
You can create a container from one set of files that works up to date tutorials.
anywhere else without having to worry about dependencies
being different on each new server.

Docker CE is useful for Linux users because it helps them in


creating their own environments without affecting other users on
the system. It also automates deployment, which eliminates Latest Tutorials
configuration errors and makes it easy to manage projects
across teams of developers who are working together on How to Shut Down Ubuntu
software applications.
How to Set JAVA_HOME Path in
In this guide, we will take a look at how we can install Docker Ubuntu 20.04 and Ubuntu 22.04
CE to create and manage development environments on an 5 Ways to Check Available Memory
AlmaLinux 8 system. in Ubuntu 22.04

Prerequisites How to Write and Run a C Program


in Linux
In order for this article to be of use, you will need the following:
Managing logs with Logrotate on
A running AlmaLinux 8 system. Ubuntu
15GB minimum of free disk space. One or more vCPUs at
your disposal per each Docker container that you want to
spin up.
A non-root user with sudo privileges.

https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 1/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

Step 1: Updating the System


There are security updates that help protect your system from
malware and other attacks on your computer. There are also
kernel updates, which add new features or improve
performance for hardware devices such as video cards and
USB controllers.

These can be installed through the dnf update command on


AlmaLinux 8.

sudo dnf -y update

Step 2: Adding Docker CE


Repository
For Red Hat-based Linux systems, there is an open Docker CE
repository that contains rpm packages for installation. Before
we can install Docker CE on AlmaLinux 8, we’ll need to add this
repository.

To add a Docker CE repository to your Rocky Linux 8 system,


execute the command listed below.

sudo dnf install -y yum-utils

sudo yum-config-manager --add-repo


https://download.docker.com/linux/centos/docker-
ce.repo

To confirm that the repository has been added properly, you can
run this command.

sudo dnf repolist


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 2/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

Step 3: Installing Docker CE


Now that we’ve added the repository, we can use it to install
Docker CE.

sudo dnf -y update

sudo dnf -y install docker-ce docker-ce-cli


containerd.io

This command will install the latest docker package for


AlmaLinux 8. It installs Docker CE, which includes Docker,
container, and command-line tools.

Once the installation has finished, you can start Docker CE with
this command.

sudo systemctl start docker

You can check whether the service has started successfully by


running this command.

sudo systemctl status docker

You should see the following output, which means that all is well.


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 3/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

If you want Docker CE to start automatically when AlmaLinux 8


boots up, run this command.

sudo systemctl enable docker

Step 4: Adding a Non-root User To


Docker Group
Docker CE uses virtualization and needs to run as a privileged
user. It is important that Docker only be accessible by the root
user. To set this up on AlmaLinux 8, we need to add new non-
root users to the Docker group. If not, you may not be able to
access virtualization facilities and encounter the permission
denied error. To add a new non-root user to the Docker group,
we need to execute the following command.

sudo usermod -aG docker $USER

Where: $USER is your non-root user username. In this example,


let’s add a user called vitux.

After running this command, log out and log back into your
system. This will ensure that the changes are applied properly.

At this point, you can verify if the non-root user is a member of


the Docker group by running this command.

id vitux


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 4/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

Step 5: Testing the Docker CE


Installation
Now that we have Docker CE installed, it’s time to test
everything working as expected.

To do this, we need a container image to use for testing. Luckily,


there is an image already available for testing purposes. Let’s
test the installation by running the hello-world container by
running the following command.

sudo docker pull hello-world

sudo docker run hello-world

This command will pull the latest hello-world image from the
Docker hub and will run it as a container. It writes Hello from
Docker! Message on your Terminal and exits, as shown below.

This output confirms the installation was successful.

If not, then there is something wrong with the Docker package,


or the user has not been added to the Docker group.

Step 6: Running a Docker


Container for Development
Purposes
Now that Docker CE is up and running let’s use it as a
development environment for your AlmaLinux 8. When you start
the hello-world container in the previous step, you are running a
virtual machine (VM) that runs and then leaves after performing 
https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 5/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

activities. It runs, emits the Hello from Docker! output, and exits
as soon as it is done.

A Docker Container can be considerably more helpful than this


default example. A Docker Container is identical to VMs with
one exception: they are less resource-intensive.

Take, for example, running a container using the most recent


Ubuntu image available from the Docker hub.

docker pull ubuntu

docker run -it ubuntu

This command will pull the latest image of Ubuntu, and it will run
in an interactive session (i.e., it stays attached to your
AlmaLinux 8 Terminal), as shown below.

Your command prompt should change to a hash mark (#) with an


id. In this case, it is f5221423e0b9. This indicates that the
container is up and running and that you are able to run
commands within it.

You can run any commands without the prefix sudo inside the
container, as you run this container as a root user. Any changes
you made in the container would only affect the container. It will
not affect the operating system you are currently logged into
(AlmaLinux 8).

Let’s run the apt update command to update the package


management system.

apt update

You should see the following output, which means that all is well.


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 6/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX

To exit the container, you can type exit at the prompt and hit
Enter.

Conclusion
In this tutorial, we have shown you how to install Docker CE on
an AlmaLinux 8 system. We hope it helped you to install Docker,
now you are ready to use its various facilities.

For more information about Docker, you can check out the
official documentation.

Karim Buzdar November 5, 2021 Linux

← How to Install and Use GDU Disk Usage Analyzer on


Ubuntu

How to Install OpenEMR Medical Office Workflow Software


on Ubuntu 20.04 →

Karim Buzdar
About the Author: Karim Buzdar holds a
degree in telecommunication
engineering and holds several sysadmin
certifications. As an IT engineer and
technical author, he writes for various
web sites. You can reach Karim on
LinkedIn

Copyright © vitux.com Privacy Policy Imprint


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 7/8
19/5/22, 15:03 How to Install and Use Docker on AlmaLinux 8 – VITUX


https://vitux.com/how-to-install-and-use-docker-on-almalinux/ 8/8

You might also like