How to Install Docker on Arch Linux: A Step-by-Step Guide

Your guide to installing Docker on Arch Linux. Simple, practical steps tailored for beginners and experts alike.

If youโ€™re venturing into the world of containerization and looking for an efficient way to deploy applications, Docker is the tool you need. But whatโ€™s better than harnessing the power of containerization on a distro that keeps you on the cutting edge?

Arch’s rolling release nature ensures that you always work with the latest software, a significant advantage for developers who want to stay ahead of the curve.

In this guide, weโ€™ll go through a detailed, step-by-step process to install Docker on Arch Linux, enabling you to leverage container technology for your projects effortlessly.

Prerequisites

Before we start, ensure that you have:

  • A running Arch Linux system.
  • A user account with sudo privileges.

Step 1: Update Your System

First, it’s a good practice to update your system to ensure all existing packages are up to date. This minimizes compatibility issues. Open your terminal and run the following Pacman command:

sudo pacman -SyuCode language: Bash (bash)

This command will fetch the latest package databases and upgrade all the installed packages to their latest versions.

Step 2: Install Docker on Arch Linux

Installing Docker on Arch is straightforward, thanks to the availability of Docker in the official Arch repository. Execute the following command:

sudo pacman -S docker docker-compose docker-buildxCode language: Bash (bash)
Install Docker on Arch Linux
Install Docker on Arch Linux

As you’ve noticed, in addition to the Docker itself, we’re installing a few additional helpful components, specifically:

  • docker: The Docker engine itself.
  • docker-compose: A configuration management tool to orchestrate the creation and management of Docker multi-container deployments using compose files.
  • docker-buildx: A CLI tool that extends the native Docker build with many new features, allowing you to build container images for multiple platforms.

Thatโ€™s all! Docker should now be installed; however, there are a few minor things to do before using it.

Step 3: Start and Enable Docker Service

To ensure Docker starts automatically at boot, enable and start the service:

sudo systemctl enable --now docker.serviceCode language: Bash (bash)
Start and enable the Docker service.
Start and enable the Docker service.

Letโ€™s check its status.

sudo systemctl is-active docker.serviceCode language: Bash (bash)
Check if the Docker service is started.
Check if the Docker service is started.

Step 4: Verify Installation

Now, letโ€™s check if everything works properly. For this purpose, we will run a simple Docker application called โ€œhello-world.โ€

sudo docker run hello-world
Docker successfully installed, up & running on Arch Linux.
Docker successfully installed, up & running on Arch Linux.

Congratulations! As we can see, everything works as expected!

Enabling Non-root Users to Run Docker Commands

So far, we have successfully installed Docker on the Arch system. However, by default, only root and users with sudo privileges can execute Docker commands.

In other words, if you attempt to run the docker command without prefixing it with sudo, youโ€™ll get an error message like this:

Docker permission denied.
Docker permission denied.

But there is no room for worries. To run Docker commands as a non-root user, you must first add your user to the โ€œdockerโ€ group. It is a simple task. To do that, type in the following:

sudo usermod -aG docker ${USER}Code language: Bash (bash)

In the above command, โ€œ${USER}โ€ is a system environment variable that contains your username. Then, run the following command to activate the changes to the group:

newgrp docker

You can then execute docker commands without prefixing them with sudo.

Run the docker command as a regular user.
Run the docker command as a regular user.

Remember that this solution will work only for your current terminal session. In other words, if you close the terminal, you will either have to execute the newgrp command above again or prefix docker commands with sudo. To make this change last permanently, just reboot your Arch system.

Conclusion

Installing Docker on Arch Linux is straightforward and allows you to benefit from the latest features and improvements in Docker technology. Youโ€™re now ready to containerize applications and fully take advantage of Docker’s efficiencies and portability.

To learn more about Docker, check out its official documentation. Additionally, we recommend our detailed guide to expanding your skills with Docker and learning how to run and manage multi-container applications using Docker Compose.

As always, if you encounter any issues or have questions, let me know in the comments section below. Thank you for following this tutorial, and happy Dockerizing!

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%