Applications in Arch Linux can be installed and used in the form of containers as they provide a full run time environment for the applications. These containers contain all the necessary libraries and dependencies to run the respective application smoothly. Now to run all the container applications, there are different tools that can be used to run applications in containers like Podman, Docker, Kubernetes and more. Docker is one of the oldest and the most popular engine that is used to run container applications on any Linux distribution.
Outline:
How to Install Docker on Arch Linux
How to use docker on Arch Linux
How to Remove Docker from Arch Linux
How to Install Docker on Arch Linux
Docker, as mentioned above, is a tool which serves the purpose of running container applications on Arch Linux, it is primarily used for testing, developing and deploying new applications. The process of installation of any package or software on Arch Linux varies but most of the applications can be installed through its default package manager. Docker on Arch Linux can be installed through various ways which will be discussed in this guide:
Method 1: Through Pacman
One of the easy and straight forward ways to install Docker on Arch Linux is by using its default package manager and for that execute:
Once the installation is complete, first start the docker service then enable it and after that check its status by executing the following:
<strong>sudo systemctl enable docker</strong>
<strong>sudo systemctl status docker
Now create a symbolic link for docker between the /usr/bin/docker executable and /usr/local/bin/docker. This allows you to run the docker command from anywhere in your terminal, without having to specify the full path to the executable:
As in the image above, you can see that there is an error of permission which means that docker can only run in root condition. To run docker in normal user mode, we have to add the user to the docker group by executing:
Here, replace the enter-your-user-name with your account name or the name of user you wish to use docker image.
Don’t forget to re-login to apply changes. So, when we access docker info with a normal user we will get results like this:
Method 2: Through Snap
Like default package manager there are some third-party package managers as well which can be used to install applications and the significance for using third party package manager is that they have most recent version of the application sometimes. To install Docker through snap package manager you need to execute the following command:
Now after installation, if you see a message for a warning then see that warning by executing the snap warnings command, and if the warning is about snap app armor, then restart the app armor service. Now perform a system reboot to apply the changes and after that confirm the installation by checking the docker version:
If in any case the version command is not executing, try enabling the docker using snap by executing:
The snap package manager is not installed by default on Arch Linux so to install it on Arch Linux clone its git repository and install the make package:
<strong>cd snapd</strong>
<strong>makepkg -si
Now enable the snap socket service and create a symbolic link so that it can be accessed from the home directory as well:
<strong>sudo ln -s /var/lib/snapd/snap /snap
Now after installation of any application you may encounter an error message of seeding error then enable the app armor service and for that execute:
Method 3: Through AUR (yay)
Arch User Repository is a community driven repo that uses helpers like yay, pacmac to install applications on Arch Linux. If you are looking for a newer version of Docker as compared to the previous methods, then used this method to install docker of Arch Linux and for that execute:
Now perform a system reboot to apply the changes and after that confirm the installation by checking the docker version:
Here you can see that using the AUR helper a relatively newer version of docker can be installed as compared to other methods. Just like other third party package managers yay is also not pre-installed on Arch so execute the below commands one by one to install yay:
<strong>cd yay</strong>
<strong>makepkg -si
How To Use Docker on Arch Linux
Docker is a utility that serves the purpose of running any application in a loosely isolated environment and that environment is usually named container. Here applications file is named as images which are first downloaded and then executed or built so here are some basic commands that you need to get familiar with for some basic tasks:
1: Downloading an Image
To run any application, you first have to download it and for that you need to use the pull command with the syntax given below:
Here for illustration, I have downloaded image for Ubuntu:
2: Searching an Image
Most of the time the applications have different names, version and creators so it’s better to search the image with name to have a list of all the relevant images and for that use the below syntax:
Here I have searched for Debian and the output have names description status of the images related to Debian:
3: Listing all the Downloaded Images
By listing the images, you will get the two types of information one is the list of images and the second one is the information about each downloaded image so to list all the images execute:
4: Running an Image
To run any application of Docker there are two ways one is by downloading the image from its registry and the other way is by creating its docker file and then building it. So, to run an image downloaded from docker registry simply execute:
5: Listing Docker Processes
To manage all the containers in Docker it is necessary to have information about all the running and stopped processes which can really help in resource allocation of the system. To list only the running processes, execute:
If you want to get the list for all the processes either running or stopped then execute the below command and further, you can manage them by using their container IDs:
6: Managing Docker Processes and Images
To completely terminate any running process just list the currently running processes note their respective container IDs and then use the kill command by flowing the below syntax:
If you want to stop any process for the time being, then use the stop command following the below syntax:
Keep in mind that to start any process using the start command is only possible if the respective application is halted or stopped not terminated.
Now to remove any application image simply use the rm command along with its container ID:
If you want to have a detailed information about all the commands along with their purposes for Docker, then consult its help by executing:
How To Remove Docker from Arch Linux
The removal process of any application on Arch Linux primarily depends on the method adopted for its installation. In case of Docker, it can be removed completely from Arch Linux using pacman which is its default repository in case if it is installed trough yay or pacman:
If you have installed docker on Arch using snap package manager than to remove it execute:
Note: There is another way for installing Docker on Arch and that is by using the git repository, but unfortunately this method is not successful as it terminates automatically during installation.
Conclusion
Docker is a tool that is primarily used to run containerized applications on any of the Linux distributions and is preferred by the developers due to its performance and convenience. To install Docker on Arch Linux there are three ways which include using pacman, AUR helper yay and snap package. If you need to install a newer, then use the AUR helper method other than that default repository method is fine. Further to need comprehensive information of Docker commands consult its help.
I’m Aaliyan javaid, an electrical engineer and a passionate tech enthusiast. I have been working with embedded systems, programming, and Linux operating systems for over 2 years. I love to explore new technologies and share my knowledge and experience with others.