Skip to main content
How to Set Up Docker on AlmaLinux and CentOS VPS - Virtarix Blog

How to Set Up Docker on AlmaLinux and CentOS VPS

November 1, 2024 · Blog / Technical Guides

This guide provides a step-by-step process for installing Docker on AlmaLinux and CentOS VPS servers. Ensure you have SSH access and root level priviledges to your VPS before starting. The process involves updating the system, checking and installing necessary packages, adding Docker repositories, and verifying the installation. Follow these instructions carefully for a successful Docker setup.

Step 1: update the system

Begin by updating your system. Once you have accessed your VPS via SSH, execute the command sudo yum update -y to ensure your system packages are up to date.

AlmaLinux terminal starting a system package update

Step 2: verify and install required packages

After updating, verify the installation of the yum-utils package. Run sudo yum install yum-utils to check and install it if necessary. After confirming the package is installed, proceed to add the Docker repository.

AlmaLinux terminal showing yum-utils installed and the Docker repository command entered

Step 3: add Docker repository

To add the Docker repository, execute the command sudo yum-config-manager --add-repo along with the appropriate repository URL. Once added, proceed to install Docker's CLI and container tools.

Terminal downloading and installing Docker packages from the added repository

Step 4: install and start Docker

After installing the Docker container tools, start the Docker service by executing sudo systemctl start docker. Verify the service is running by checking its status with sudo systemctl status docker.

Terminal showing the Docker service active after installation

Step 5: test Docker installation

Once confirmed that Docker is active, test the installation by running a test container. Execute sudo docker run hello-world to ensure Docker is correctly set up and functioning.

Docker service status followed by a failed pull for hello-world

Step 6: confirm successful setup

To further confirm Docker's operation, run sudo docker run hello-world once more. This repetition ensures the Docker setup was successful and is operating correctly.

Terminal showing Docker's successful Hello World output

Frequently asked questions

What should I do if the Docker service fails to start?

If the Docker service fails to start, first check the status with sudo systemctl status docker to view detailed error messages. Ensure that all dependencies are installed and compatible. If you encounter issues, try restarting the service using sudo systemctl restart docker and review the Docker logs with journalctl -u docker.

How do I add a specific version of Docker to my system?

To install a specific version, first list all available versions using yum list docker-ce --showduplicates | sort -r. Then install the chosen version with sudo yum install docker-ce-VERSION_STRING docker-ce-cli-VERSION_STRING, replacing VERSION_STRING with the version shown by the list command.

Can I use Docker without root privileges?

Yes, it is possible to use Docker without root privileges by adding your user to the Docker group. Execute sudo usermod -aG docker $USER and then log out and back in for the changes to take effect. This allows non-root users to run Docker commands.

How can I completely remove Docker from my system?

To remove Docker, use the command sudo yum remove docker-ce docker-ce-cli containerd.io to uninstall the packages. Additionally, delete Docker directories like /var/lib/docker if you wish to clear all Docker-related data.

Ready to run Docker on AlmaLinux or CentOS VPS?

Compare Virtarix VPS sizes for Docker hosts with root access, NVMe storage, IPv4 + IPv6, snapshots, backups, and enough room for containers and images.

VPS S

For small sites, dev servers and Docker

$ 5 .50 /month
  • 3 cores
  • 6 GB
  • 50 GB NVMe
  • Unlimited
Get It Now
BEST SELLER

VPS M

For growing apps, websites and staging

$ 11 .40 /month
  • 6 cores
  • 16 GB
  • 100 GB NVMe
  • Unlimited
Get It Now
Peter French
About the Author Peter Frenchis the Managing Director at Virtarix, with over 17 years in the tech industry. He has co-founded a cloud storage business, led strategy at a global cloud computing leader, and driven market growth in cybersecurity and data protection.