Arch Linux Docker

How to Install and Start Docker in Arch Linux

In the language of programming, Docker is renowned as the premier platform as a software container. Docker’s description as a container ensures the smooth running of the software contained in its library with proper settings. One of the primary reasons why programmers are inclined towards using Docker is because it administers the issues pertinent to the server. Docker provides you affirmation that wherever you run the software, its functions will run smoothly and without any issues.

Docker is highly compatible with almost all the Linux distributions. Docker can run software, as well as build images from its library. In simplified terms, Docker is the tool that eases issues when running deployed software. The snap operates on code from Docker, but itself is not an entity of Docker. The latest update of the Docker shows the Apache license 2.0 and has reserved copyrights over its domain. The container system of Docker offers an optimal solution for operating software. That provides Docker an edge over other package-building platforms. This guide specifies all the steps necessary to install Docker on your Arch Linux operating system.

Process for Installing Docker

The installation of Docker in Arch Linux is extremely easy due to the Arch Unit Repository (AUR). All you need to do is grab the Docker package from the AUR and then enable the package on your server. Follow the five steps listed below to install docker on your Arch Linux system:

  • Step 1: Enable the loop module
  • Step 2: Enable snapd through AUR
  • Step 3: Install Docker
  • Step 4: Enable Docker
  • Step 5: Perform post-install configuration

Prerequisites

Before installing Docker on your server, you must consider the availability of prerequisites on your server. Docker is not particularly compatible with modified new-generation devices; rather, it supports the 64_bit system abruptly. The loop module loaded during the process also influences the installation of Docker. Ensure the availability of AUR packages in your server. Also, make certain that your system is up-to-date before proceeding further with this command.

$ sudo pacman -Syu

Enable Loop Module

Before enabling the loop mode, first, check whether the loop mode exists in the server as a kernel module for Docker through the following command:

$ lsmod | grep loop


If, after running this command, it shows that the loop module is not loaded, then run the following commands to load it first.

$ sudo tee /etc/modules-load.d/loop.conf <<< "loop"
$ modprobe loop


The first command formulates the loop configured file, and the second command thrusts the module into the Linux kernel.

Enable snapd through AUR

To enable snapd, you must first download the Docker package from the AUR. If the requisites of the AUR are set in place, then you can go ahead and install Docker from the AUR.
Note that using AUR is not always safe if you do not have proper authentication over its operationality; it is better to opt for other ways if you are new to the AUR because you need to be very specific and careful with your commands in this repository. Perform the following commands to install snapd:

$ git clone https://aur.archlinux.org/snapd.git

$ cd snapd

$ makepkg -si


This final command picks the Docker package from the AUR.
Now, as for the installation of packages from the AUR, enable the snapd socket by issuing the following command in the terminal system:

$ sudo systemctl enable --now snapd.socket


Next, form a generic link between /snap and its respective library /var/lib/snapd/snap using the following command:

$ sudo ln -s /var/lib/snapd/snap /snap


That is all you need to do to get the Docker package from the AUR in your Arch Linux system. Now, simply your server to validate that you have fetched the Docker package from the AUR.

Install Docker

After enabling loop and snapd, all there is left to do is to install Docker. Issue the following command to complete the installation.

$ sudo snap install docker

Start Docker

To effectively use Docker in Arch Linux, enable it on your server. Input the following command to enable and start Docker:

$ systemctl start docker.service

This command will instantly start Docker. Now, to automatically boot Docker on restart, use the following command:

$ systemctl enable docker.service


If you are still confused and want to confirm that Docker has been enabled on your server., the following command will assist you in confirming this:

$ docker info


An important point to ponder is to know that you can run Docker in your system as a root server. If you wish to run the operations of Docker just like other regular users, then you can enlist yourself in the Docker group using the following command:

$ groupadd docker

The above command will formulate a group of docker users. The following command will enroll the user in the respective group:

$ gpasswd -a user docker [replace user with your username]

Restart the server or opt for the re-login option to finalize the changes as the root user.

Post-Installation Configuration

If you are reluctant to change the position of Docker images, then you can do so in the post-installation configuration of Docker. The default images of Docker are restored in the virtual link generated when enabling snapd. So, to change that location, you must stop Docker first, then input the command to change the location of your Docker images.

Using Docker

To check the version of Docker, issue the following:

$ docker version

To search an image, issue the following:

$ docker search <image_name>


To download an image, issue the following:

$ docker pull <image_name>


To run an image, issue the following:

$ docker run <image_name> <options>

Conclusion

With Docker, you can get yourself some extremely secure packages. This guide explains in detail how to install Docker in Arch Linux. Now, you can effortlessly run Docker software applications in Linux. Docker ensures a great experience when programming in Arch Linux.

About the author

Younis Said

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.