Docker is a containerization platform that supports the building, running, and easy managing of applications. The Docker container bundles its configuration files, software, and libraries, such that each container is isolated from other containers. The good thing about containers is that they can share resources despite being isolated, making them a better alternative than virtualization. Moreover, one host system can run multiple Docker containers.
This guide focuses on understanding how to get started with Docker on Arch Linux. We will discuss how to install Docker and configure it for Arch-based Linux Distributions.
Getting Started With Docker on Arch Linux
When installing Docker, you can choose the development or stable version. In this tutorial, we will work with the stable version, the official version recommended for users.
Installing Docker
Start by updating the software repository of your system using the following command:
Once the repository is updated, let’s install Docker using pacman from the official repository.
When prompted to allow the installation to proceed, press Y.
With Docker installed, we must start its Daemon using the systemctl command as shown below:
Verify that Docker is running using the status option as shown below:
The previous command only starts Docker whenever you want to use it. However, you can set the docker daemon to start at boot time using the enable command, as shown below:
Docker requires sudo privileges for you to run it. Therefore, we must add a user to the Docker group to avoid having to root every time we need to run it.
Add the current user account to the Docker group using the following command:
Enter your password to authorize the user you add to the docker group. You must log out for the changes to effect.
Also, you can verify that Docker is running by running hello-world.
Docker will search for the image hello-world, and if not found, it will pull it from the Docker hub.
The output should return a message confirming that your installation was successful and that Docker is working correctly.
Now, you can use Docker commands to create and manage your applications.
Let’s see the following common Docker commands and what they do:
-
- Docker run: Used when you want to create and run a container
- Docker start: Used when you want to start a stopped container
- Docker stop: Used to stop a container
- Docker volume create: Used when you want to create a volume for the container
- Docker rm: Used when you want to remove a container
- Docker ps: Used to monitor a container by checking its status to see the running containers
- Docker images: Used when checking the images that are on your system
- Docker pull: Used when you want to download an image from Docker hub but don’t want to run it
Conclusion
This guide has offered a hands-on guide on getting started with Docker on Arch Linux. We’ve seen how to install Docker, start the Daemon, add a user to the Docker group, and the various commands you can use with Docker. Hopefully, you now have a better understanding and foundation for using Docker on Arch Linux.