Introduction
Docker is a powerful platform that allows you to create, deploy, and manage containerized applications with ease. If you’re using AlmaLinux as your server OS, you might be wondering how to get Docker up and running efficiently. This guide will walk you through the process of installing and configuring Docker Engine on an AlmaLinux VPS.
Prerequisites
Before we begin, ensure that you have the following:
- A VPS running AlmaLinux 8 or later
- A user account with sudo privileges
- An active internet connection
How to Install and Run Docker Engine on AlmaLinux VPS
To install and run Docker Engine on AlmaLinux VPS, follow the steps below:
-
Update Your System
It’s always a good practice to update your system packages before installing new software. Login via SSH to the VPS and run the following command:
sudo dnf update -y
This ensures that you have the latest security patches and software updates.
-
Install Required Dependencies
Docker requires some additional packages to function correctly. Install them using the following command:
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
These utilities help manage repositories and dependencies needed for Docker.
-
Add Docker Repository
Docker is not available in AlmaLinux’s default repositories, so we need to add the official Docker repository:
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Since AlmaLinux is a CentOS-based distribution, we use the CentOS repository for Docker.
-
Install Docker Engine
Once the repository is added, install Docker Engine with:
sudo dnf install -y docker-ce docker-ce-cli containerd.io
This command will install the Docker Engine, CLI, and Containerd runtime.
-
Start and Enable Docker Service
After the installation is complete, start and enable the Docker service to ensure it runs automatically on boot:
sudo systemctl start docker sudo systemctl enable docker
Verify that Docker is running with:
sudo systemctl status docker
If Docker is active and running, you should see output confirming its status.
-
Verify Docker Installation
To check if Docker is installed correctly, run the following command:
sudo docker run hello-world
This command pulls and runs a test container, displaying a confirmation message if everything is working properly.
-
Allow Non-Root Users to Run Docker (Optional)
By default, only the root user and users with sudo privileges can run Docker commands. To allow a non-root user to run Docker, add them to the docker group:
sudo usermod -aG docker $USER
Then, log out and back in for the changes to take effect. You can verify by running:
docker run hello-world
-
Enable Docker to Start on Boot
To ensure Docker starts automatically when the system reboots, use:
sudo systemctl enable docker
Conclusion
Congratulations! You have successfully installed and configured Docker Engine on your AlmaLinux VPS. You can now start deploying and managing containers efficiently. To explore more Docker capabilities, check out the official Docker documentation.
If you have any questions about how to install and run Docker Engine on AlmaLinux VPS, feel free to leave a comment below!
[…] AlmaLinux Instructions […]