How to Install and Setup Docker on Arch Linux
Installable through AUR repository via terminal commands.
sudo pacman -S docker
Starting the Docker daemon
Docker will be installed although not running. Start and run the Docker command for the first time:
sudo systemctl start docker.service
Start Docker on system boot (Optional)
To run the Docker service and daemon automatically on system boot:
sudo systemctl enable docker.service
Add user to Docker group
Docker is now installed and the Docker service is running. By default, you can begin running Docker commands although will require you to sudo every time you run a Docker command which is cumbersome, tedious, not efficient/optimal, and can be annoying.
To avoid using sudo with every Docker command you can add your existing user (or any user) to the Docker group:
sudo usermod -aG docker $USER
You will need to log out (close the terminal) and log back in before the changes take effect. Otherwise you can run the command below:
newgrp docker
Verify Docker installation
Docker has a tiny image provided by Docker itself to test the installation. Run it to see if everything is working:
docker run hello-world
List running Docker containers:
docker ps -a
You should see the running container in the terminal listing container id, name, and other viable information. To clean up and stop running containers run the command below:
sudo docker stop container_id or name
To remove the test image container “hello-world”
sudo docker rm container_id or name
Congratulations! You have successfully installed Docker on Arch Linux.