| by Arround The Web | No comments

Arch Linux Docker Tutorial

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:

$ sudo pacman -Syu

 

Once the repository is updated, let’s install Docker using pacman from the official repository.

$ sudo pacman -S docker

 

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:

$ sudo systemctl start docker.service

 
Verify that Docker is running using the status option as shown below:

$ sudo systemctl status docker.service

 

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:

$ sudo systemctl enable docker.service

 

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:

$ sudo usermod -aG docker $USER

 
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 run 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:

    1. Docker run: Used when you want to create and run a container
    2. Docker start: Used when you want to start a stopped container
    3. Docker stop: Used to stop a container
    4. Docker volume create: Used when you want to create a volume for the container
    5. Docker rm: Used when you want to remove a container
    6. Docker ps: Used to monitor a container by checking its status to see the running containers
    7. Docker images: Used when checking the images that are on your system
    8. 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.

Share Button

Source: linuxhint.com

Leave a Reply