Install and use docker on Debian 10
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. containers are isolated from one another and bundle their own software, libraries and configuration files. they can communicate with each other through well-defined channels.
In this tutorial, we will learn how to install and use Docker on debian 10 system.
prerequisites:
you need to install some required packages on your system for installing Docker
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Also Read -> How to Install php 8 on Debian 10
Step1 : setup Docker PPA
First we need to import dockers official GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Add docker repository to your system
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
Step 2: Install docker
Now upgrade apt index and then install Docker community edition on Debian.
sudo apt-get update
sudo apt-get install docker-ce
once it is installed, service will start automatically. To verify service status run following command.
sudo systemctl status docker
sample output:
root@debian:~# sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-03-26 03:29:26 PDT; 56s ago
Docs: https://docs.docker.com
Also Read -> How to Install Ruby on Rails on Debian 10
Basic commands:
To verify the docker installation, try to deploy hello-world container.
docker --version
sudo docker run hello-world
To search for an image from the Docker Hub registry, use below command
docker search debian
download the latest version of the Debian image
docker pull debian
You can also list the downloaded image with the following command.
docker images
To start a Docker container based on the Debian image. If you don’t have the image locally, it will be downloaded first.
docker container run debian
To list running docker containers use below command.
docker container ls
To view all containters.
docker container ls -a
That's it. Now you have successfully installed docker on debian 10 system.
Also Read -> How to Install Apache Maven on Debian 10