DEV Community

Cover image for Docker on Linux: A Quick Guide for Debian and Arch-Based Systems
Kosa Matyas
Kosa Matyas

Posted on

Docker on Linux: A Quick Guide for Debian and Arch-Based Systems

Docker is an essential tool for modern software development. It simplifies deploying applications by isolating them in lightweight, portable containers. This guide will walk you through installing Docker on Debian and Arch-based systems, verifying the installation, and running your first container.


Installing Docker on Debian-Based Systems

1.Update the Package Index

Open a terminal and run:

   sudo apt update
Enter fullscreen mode Exit fullscreen mode

2.Install Required Dependencies

Install packages required to add Docker's official GPG key and repository:

       sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
Enter fullscreen mode Exit fullscreen mode

3.Add Docker's GPG Key and Repository

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Enter fullscreen mode Exit fullscreen mode

4.Install Docker

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Enter fullscreen mode Exit fullscreen mode

5.Verify Installation

docker --version
Enter fullscreen mode Exit fullscreen mode

Installing Docker on Arch-Based Systems

1.Update the System
Run the following command to ensure your system is up-to-date:

sudo pacman -Syu
Enter fullscreen mode Exit fullscreen mode

2.Install Docker

sudo pacman -S docker
Enter fullscreen mode Exit fullscreen mode

3.Start and Enable Docker
Start the Docker service and enable it to run at boot:

sudo systemctl start docker
sudo systemctl enable docker
Enter fullscreen mode Exit fullscreen mode

4.Verify Installation

docker --version
Enter fullscreen mode Exit fullscreen mode

Testing Docker Installation

To ensure Docker is properly installed and running:

1.Check the Docker Service

sudo systemctl status docker
Enter fullscreen mode Exit fullscreen mode

You should see a status like Active: active (running).

2.Run the Hello World Container
Test your Docker setup by running a test container:

sudo docker run hello-world
Enter fullscreen mode Exit fullscreen mode

If Docker is correctly installed, you'll see a message like:

Hello from Docker! This message shows that your installation appears to be working correctly.
Enter fullscreen mode Exit fullscreen mode

Conclusion

Congratulations! You’ve installed Docker, tested its setup, and run your first container. Whether you’re on Debian or Arch-based Linux, Docker simplifies application deployment and development. Dive deeper into Docker’s capabilities, and start containerizing your applications today!

Top comments (0)