How to install and use Docker in Debian 10

Install docker community edition (CE) on Debian 10

prerequisites: 

1. Cloud VPS with Debian 10 installed (you can check all VPS packages here)

2. An account on Docker Hub)

Step 1. Installing Docker:

The Docker installation package available in official Debian repository may not be the latest version. So, we will install docker from the official Docker repository to ensure getting the latest version. To do that, we have to add a new package with GPG key from Docker to ensure the package is valid.

First, we need to update Debian existing list of packages

sudo apt update

Next, install few prerequisite packages which let apt use package over HTTPS

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

Then add the GPG key of offecial Docker repository

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

Then add Docker repository to apt sources

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Then, Update the package database with Docker packages from the new added repository

sudo apt update

Finally, Install Docker

sudo apt install docker-ce

Now, Docker is installed, the daemon is started and the process enabled to start on boot.

To check that Docker is running

sudo systemctl status docker

You should get that the process is active

Step 2. Executing Docker commands without sudo (Optional)

By default, Docker commands can only run using the root user or by user in the Docker group.

To add your user to Docker user group

sudo usermod -aG docker ${USER}

You will need to log out then log in to apply the changes

Step 3- Using Docker commands

To see all Docker commands

$ docker

Finally, you installed Docker and learnt how to use it

Diana May 8, 2022
Share this post
Our blogs
Archive
Sign in to leave a comment
Install Odoo 15 on Ubuntu 20.04 LTS Server
Installing Odoo 15 on ubuntu 20.04