Arch Linux Containers Dev Ops

Arch Linux Docker Tutorial

What Is Docker?

If you read technology news websites, you’ve most likely heard about Docker and all the wonderful things this open platform that allows developers and sysadmins to build, ship, and run distributed applications can do. But why just read about Docker when you can try it first-hand? In this tutorial, we’ll teach you how to install and configure Docker on Arch Linux, and we’ll also show you a few examples of what you can do with Docker.

On its official website, Docker is described as “world’s leading software container platform.” Okay, but what is a container? A container is a self-contained bundle of libraries and settings that guarantees that a piece of software will always run exactly the same, regardless of where it’s deployed.

In other words, containers, and Docker, solve the fragmentation issue that has been plaguing the Unix world for decades. Finally, developers can easily take software from development machines to remote servers and know with certainty that everything will run as expected.

Docker was initially released in 2013 by the company Docker, Inc. The person who started Docker is Solomon Hykes, who was the co-founder and CEO of dotCloud, a platform-as-a-service company. Several dotCloud engineers contributed to Docker, including Andrea Luzzardi and Francois-Xavier Bourlet.

Just three years after Docker’s initial release, an analysis revealed that major contributors to Docker include Red Hat, IBM, Microsoft, Huawei, Google, and Cisco. In a short time, Docker has caught the attention of some of the largest companies in the world and established itself as the leading software container platform.

How to Install Docker on Arch Linux

0. Before You Begin

Even though Arch Linux still allows i686 installations to receive upgraded packages, in accordance with the distribution’s plans to phase out the support of this architecture, Docker supports only 64-bit systems. That dusty old machine you may have in your closet may be great for some retro-gaming, but you won’t be able to run Docker on it.

1. Enable the Loop Module

Besides the 64-bit architecture, Docker also depends on the loop module, which is a block device that maps its data blocks not to a physical device such as a hard disk or optical disk drive, but to the blocks of a regular file in a filesystem or to another block device, according to Linux Programmer’s Manual.

Docker should enable the loop module automatically during installation.  Check if ”loop” has been loaded as a kernel module:

# lsmod | grep loop

If the loop module has been loaded, you may skip to the next step. Otherwise, run the following two commands:

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

The first command passes the word “loop” to the standard input of the command on the left, which is the command tee. Then, tee writes the word “loop” to the file loop.conf.  The modprobe command adds the loop module to the Linux kernel.

2. Install Docker

You can choose whether you want to install a stable version of Docker from the Community repository or a development version from AUR. The former is called simply docker, and the latter is called docker-git.  If you’re new to using Docker in general or just using Docker on Arch Linux, we highly recommend you install the stable package:

# pacman -S docker

3. Start and Enable Docker

Before you can use Docker on Arch Linux, you have to start and enable the Docker daemon using system:

# systemctl start docker.service
# systemctl enable docker.service

The first command immediately starts the Docker daemon, and the second command ensures that the daemon will start automatically on bootup.

Optionally, use the following command to verify the installation and activation:

# docker info

Note that you can run Docker only as root. To run Docker as a regular user, add yourself to the docker group:

# groupadd docker
# gpasswd -a user docker [replace user with your username]

The first command creates a new group called docker, and the second command adds a user to the group. Don’t forget to re-login to apply the changes.

Post-Install Configuration

Provided that your host machine is properly configured to begin with, there’s not much left to do after the installation before you can start using Docker on Arch Linux.

You may want to change the location of Docker images, however. Docker stores images by default in /var/lib/docker. To change their location, fist stop the Docker daemon:

# systemctl stop docker.service

Then, move the images to the target destination. Finally, add the following parameter to the ExecStart in /etc/systemd/system/docker.service.d/docker-storage.conf:

ExecStart=/usr/bin/dockerd --data-root=/path/to/new/location/docker -H fd://

For more post-install configuration options, see Docker’s official Arch wiki page

Using Docker on Arch Linux

With Docker installed and configured, it’s time to finally have some fun with it. To see what Docker can do, ask it to list all available commands:

# docker

You can ask Docker to tell you its version or give you system-wide information:

# docker version
# docker info

When you’re ready to try something more interesting, you may download an x86_64 Arch Linux image:

# docker pull base/archlinux

Best of all, you can use the downloaded image to create a new container by specifying a command to run using the image:

# docker run [image name] [command to run]

If the container suddenly stops, you can start it again:

# docker run [container ID]

And if you want it to stop, you can do that as well:

# docker stop [container ID]

Finally, you can easily delete a container and start from scratch:

# docker rm [container ID]


Docker is an immensely powerful software technology, and this tutorial is only an introduction for those who have never used it before. You can learn much more about Docker from the official documentation, which is always kept up to date. If you’d like to learn how to define and deploy applications with Docker, check the Get started with Docker guide. If you run into any problems with Docker, the Troubleshooting page is the best place where to look for a solution.

About the author

David Morelo

Content writer and copywriter, researcher, wannabe linguistic, part-time marketer, gym rat, sometimes annoying but always loving boyfriend.

I was born and raised in the Czech Republic, where I studied English and Japanese philology at the Palacký University in Olomouc, the second oldest university in the Czech Republic and the largest university in Moravia, one of the historical Czech lands.