Logo

dev-resources.site

for different kinds of informations.

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

Published at
11/23/2024
Categories
linux
docker
devops
ubuntu
Author
Kosa Matyas
Categories
4 categories in total
linux
open
docker
open
devops
open
ubuntu
open
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

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

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

4.Install Docker

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

5.Verify Installation

docker --version

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

2.Install Docker

sudo pacman -S docker

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

sudo systemctl start docker
sudo systemctl enable docker

4.Verify Installation

docker --version

Testing Docker Installation

To ensure Docker is properly installed and running:

1.Check the Docker Service

sudo systemctl status docker

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

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.

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!

Featured ones: