Friday, November 15, 2024
Google search engine
HomeGuest BlogsHow To Install Docker on Debian 10 Buster

How To Install Docker on Debian 10 Buster

Introduction

DockerĀ is used for creating, deploying, and managing containers for application development. It uses OS virtualization to isolate containers and allow them to communicate with each other.

In this tutorial, you will learn how to install Docker on Debian 10.

Tutorial on how to install Docker on Debian 10.Tutorial on how to install Docker on Debian 10.

Prerequisites

  • Debian 10 installed and configured
  • Access to a command line/terminal window
  • A user account with sudo privileges

Docker on Debian 10

To set up Docker, you will need to prepare the system for installation. Deleting older versions of Docker packages and downloading the required dependencies speeds up the process.

Step 1: Uninstall Default Docker Packages

The first step is to remove old versions of docker,Ā docker.io, and docker-engine that may already be on the system. These versions are not required for the latest stable release of Docker.

Delete the outdated packages by typing the following command in the terminal:

sudo apt-get purge docker lxc-docker docker-engine docker.io

Step 2: Install Required Packages

Update the default repository with the command:

sudo apt-get update

Download the following dependencies:

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

By doing so, this allows you to add a new repository over HTTPS.

Step 3: Install Docker

There are several ways to install Docker:

  1. The standard and most practical approach is to set up Docker repositories and install the software from them.
  2. Alternatively, download the DEB package and install Docker manually. This method is recommended for users that have air-gapped systems with no access to the internet.
  3. If you have Raspbian, the only way to set up Docker is by using automated convenience scripts.

Method 1: Install Docker Using the Repository on Debian 10

The best option for most Debian 10 users will be to install Docker from its official repositories. To do so, follow the steps outlined below.

1. Download Dockerā€™s official GPG key to verify the integrity of packages before installing:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

2. Add the Docker repository to your system repository with the following command:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"

3. Update the apt repository:

sudo apt-get update

4. Install Docker Engine ā€“ Community (the latest version of Docker) and containerd:

sudo apt-get install docker-ce docker-ce-cli containerd.io

5. The service will start automatically after the installation. Check the status by typing:

sudo systemctl status docker
check if docker service is running and activecheck if docker service is running and active

6. You can also verify the installation by asking for the Docker version:

docker -v
ckeck docker version in debian busterckeck docker version in debian buster

Method 2: Install Docker Manually on Debian 10

Users who cannot install Docker from its repositories (or prefer not to) have the option of installing the software manually.

1.Navigate to the following URL:

https://download.docker.com/linux/debian/dists/

2. Click the version of Debian you are using. In this case, it is Buster.

download deb package to install docker on debian busterdownload deb package to install docker on debian buster

3. Click pool >Ā stable, and finally amd64.

steps for manually installing docker on debian 10steps for manually installing docker on debian 10

4. Next, you will see a list of all the available .deb packages, including the new releases and older versions. The list will consist of multiple versions of three essential Docker packages:

  • containerd
  • docker-ce-cli (Dockerā€™s command user interface)
  • docker-ce

Unless you require a specific version, go for the latest stable release. Click the newest version for each software package to download them.

a list of all available docker packages for debiana list of all available docker packages for debian

The system will most often store the .deb files in the Downloads folder.

locate deb files for dockerlocate deb files for docker

5. Return to the command line and navigate to the Downloads folder with the following command:

cd Downloads

6. To set up Docker, use the dpkg command to install each of the three packages. Make sure to do it in the following order:

sudo dpkg -i containerd.io_1.2.6-3_amd64.deb
command to install containerd from deb filecommand to install containerd from deb file
sudo dpkg -i docker-ce-cli_19.03.3~3-0~debian-buster_amd64.deb
command to install docker-ce-cli from deb filecommand to install docker-ce-cli from deb file
sudo dpkg -i docker-ce_19.03.3~3-0~debian-buster_amd64.deb
command to install docker-ce from deb filecommand to install docker-ce from deb file

Step 4: Verify the Installation With a Hello World Image

The best way to ensure that the container service has been configured correctly is to run a hello-world test image.

docker run hello-world

The command automatically downloads the hello-world image. It also creates a container based on that image.

The following output will appear in the terminal, verifying that you have successfully configured Docker on Debian 10:

Hello from Docker!
This message shows that your installation appears to be working correctly.
run hello world test image in dockerrun hello world test image in docker

Bonus: Uninstall and Remove Docker

If you need to uninstall Docker, run the following command:

sudo apt-get purge docker-ce

The command deletes the docker-ce package. However, any additional files related to it, such as images, containers, and custom configuration files, remain on the system. Remove everything from the Docker directory with the command:

sudo rm -rf /var/lib/docker

Conclusion

Now that you know how to install Docker on Debian 10, you can also get started with learning the basic commands and functions.

If you have never worked with Docker containers, we highly recommend reading how to list, start, and stop Docker containers next.

Was this article helpful?
YesNo

RELATED ARTICLES

Most Popular

Recent Comments

ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
źøˆģ²œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
źµ¬ģ›”ė™ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ˜¤ģ‚°ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ•ˆģ–‘ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė™ķƒ„ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ„œģšøģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶„ė‹¹ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ź³”ė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź³ ģ–‘ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ģ„±ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ²œķ˜øė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?