Arch Linux

How to Install and Use Docker on Arch Linux

The goal of Docker is to make the creation, distribution, and running of the applications in containers easier. On Arch Linux, Docker may be used to execute the containerized apps outside of the host system in a user-specified domain. Separating the application from the host machine improves consistency and repeatability when delivering the applications and increases security. Furthermore beneficial for development and testing, Docker may be used to handle numerous separate environments on a single system.

Update the Arch Linux

It’s time to update our Arch Linux with all of its utilities. The “sudo pacman -Syu” command is used on an Arch Linux shell to update the system’s packages. The “sudo” command allows the user to run the subsequent “pacman -Syu” command with superuser (administrator) privileges. The “-S” flag tells pacman to sync (install or update) the packages. The “y” flag tells it to refresh the package lists. And the “u” flag tells it to perform a full system upgrade. The output shows that pacman first synchronizes the package databases for the “core”, “extra”, and “community” repositories. It then proceeds with the full system upgrade. It reports the total number of packages that are upgraded, the total download and installed size of those packages, and the net upgrade size. It then asks the user for confirmation to proceed with the installation (“Proceed with installation? [Y/n] y”).

[omar@omar ~]$ sudo pacman -Syu


Create a Loop Component

A standard file or block device can be employed as a virtual block device with the help of the loop component, a kernel module. This may be used for encryption, compression, and the creation of file-based virtual disc images. The “loop.conf” file contains the “loop” string as its only content. This is typically used to load the modules automatically at boot time. The following command is used to create a new configuration file called “loop.conf” in the “/etc/module-load.d” directory. Using the “tee” command, you can read from the standard input and output to one or more files as well as standard output. In this case, the command writes the “loop” string to a new file called “loop.conf” in the “/etc/module-load.d” directory. The “<<<” operator is used to pass the “loop” string as the input to the “tee” command. Then, it shows that the /etc/module-load.d/loop.conf file does not exist and it creates the file with the “loop” content in it.

[omar@omar ~]$ sudo tee /etc/module-load.d/loop.conf <<< "loop"
[sudo] password for omar:
tee: /etc/module-load.d/loop.conf: No such file or directory


The modprobe loop command is used to load the kernel module for loop devices. When the modprobe command is executed with the loop argument, it checks to see if the loop module is already loaded in the kernel. If it is not, the command loads the module into the kernel, making it available for use. Once the module is loaded, it can be used to create the loop devices.

[omar@omar ~]$ modprobe loop


Install the Docker

The following pacman instruction is here to install the Docker package on a computer running Arch Linux. The pacman command uses the -S flag to specify that the command installs a package. The command indicates that the package is already installed and is up to date. Therefore, it reinstalls the package. Once the package is installed successfully, the command runs some post-transaction hooks.

[omar@omar ~]$ sudo pacman -S docker
warning: docker-1:20.10.23-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Packages (1) docker-1:20.10.23-1
Total Installed Size:  113.55 MiB
Net Upgrade Size:        0.00 MiB
:: Proceed with installation? [Y/n] y
:: Processing package changes...
(1/1) reinstalling docker                          [######################] 100%
:: Running post-transaction hooks...
(1/4) Creating system user accounts...
(2/4) Reloading system manager configuration...
(3/4) Reloading device manager configuration...
(4/4) Arming ConditionNeedsUpdate...


Clone the Docker

It’s time to clone the Docker’s official repository from Git which is a repository that is located at the specified URL. The command creates a new directory called “docker-git” and copies the entire contents of the remote repository to the local machine. It starts by enumerating the objects in the remote repository. Then, it counts and compresses them.

[omar@omar ~]$ git clone


Install the Base-Devel

The following command is used to install the base-devel package group on a computer running Arch Linux. It is a meta package that contains the basic development tools. It contains a set of packages that provide the tools which are necessary to build and develop the Arch Linux packages. Tools like the GNU Compiler Collection (GCC), GNU Binutils, and the GNU Build System are part of this package category (automake, autoconf, etc.). The command shows that there are 26 members in the group base-devel and it lists them. It also asks the user to select which package to install. By default, it installs all of them. Once the user confirms with “y”, the package is installed and the command gives a progress bar which indicates the status of the installation.

[omar@omar ~]$ sudo pacman -S base-devel
:: There are 26 members in group base-devel:
:: Repository core
   1) archlinux-keyring  2) autoconf  3) automake  4) binutils  5) bison
   6) debugedit  7) fakeroot  8) file  9) findutils  10) flex  11) gawk
   12) gcc  13) gettext  14) grep  15) groff  16) gzip  17) libtool  18) m4
   19) make  20) pacman  21) patch  22) pkgconf  23) sed  24) sudo  25) texinfo
   26) which
Enter a selection (default=all):
warning: archlinux-keyring-20221220-1 is up to date -- reinstalling
warning: autoconf-2.71-1 is up to date -- reinstalling
looking for conflicting packages...
Packages (26)
Total Installed Size:  272.07 MiB
Net Upgrade Size:        0.00 MiB
:: Proceed with installation? [Y/n] y
:: Processing package changes...
==> Appending keys from archlinux.gpg...
==> Updating trust database...
gpg: next trustdb check due at 2023-04-21
==> Updating trust database...
:: Running post-transaction hooks...
(1/4) Reloading system manager configuration...
(2/4) Creating temporary files...
(3/4) Arming ConditionNeedsUpdate...
(4/4) Updating the info directory file...


The following command is used to change the current working directory to a directory called “docker-git” that is created by the user “omar” and contains the files or subdirectories which are related to the use of Docker and Git which we just created in the previous illustrations.

[omar@omar ~]$ cd docker-git/


Build the Docker

The “makepkg” command is used to build the packages for Arch Linux and its derivatives. The “-s” flag is used to indicate that the package should be built using the source code rather than pre-compiled binaries. The “-r” flag is used to indicate that the package should be installed automatically after it is built. The “i” flag is used to indicate that any existing package with the same name should be overwritten. The output of the command shows that the process checks the runtime and build-time dependencies. Then, it’s going to retrieve the sources. After that, it clones two Git repositories, one is “moby” and the other one is “docker-ce”, both are cloned into the “docker-git” directory.

[omar@omar docker-git]$ makepkg -sri


Now, you need to enable the Docker service using the following systemctl instruction:

[omar@omar docker-git]$ sudo systemctl enable docker.service


Use the following instruction to launch the Docker:

[omar@omar docker-git]$ docker run hello-world



This article elaborates on the use of Docker in Arch Linux with the help of its introductory paragraph. After updating our Arch Linux system, we created a new loop configuration file followed by the modprobe loop instruction that is utilized to load the kernel module for loop devices. Then, we installed the Docker package and cloned the docker-git repository in Arch Linux. After building the packages for docker-git, we successfully installed the Docker.

About the author

Omar Farooq

Hello Readers, I am Omar and I have been writing technical articles from last decade. You can check out my writing pieces.