# lsb_release -a<\/pre>\nYou should get this as the output:<\/p>\n
Distributor ID: Debian\r\nDescription: Debian GNU\/Linux 10 (buster)\r\nRelease: 10\r\nCodename: buster<\/pre>\nThen, run the following command to make sure that all installed packages on the server are updated to their latest available versions:<\/p>\n
# apt update && apt upgrade\r\n<\/pre>\n<\/span>Step 2: Install Docker<\/span><\/h2>\nBefore starting, you will need to install some dependencies to allow your system to access the Docker repositories over HTTPS. You can install all of them with the following command:<\/p>\n
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common<\/pre>\nOnce all the required dependencies are installed, download and add the Docker’s GPG key with the following command:<\/p>\n
curl -fsSL https:\/\/download.docker.com\/linux\/debian\/gpg | sudo apt-key add -<\/pre>\nNext, add the Docker repository with the following command:<\/p>\n
sudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/debian $(lsb_release -cs) stable\"<\/pre>\nFinally, update the repository and install the latest version of Docker with the following command:<\/p>\n
sudo apt-get update\r\nsudo apt-get install docker-ce<\/pre>\nOnce the installation has been completed, check the status of Docker with the following command:<\/p>\n
sudo systemctl status docker\r\n\r\n\u25cf docker.service - Docker Application Container Engine\r\nLoaded: loaded (\/lib\/systemd\/system\/docker.service; enabled; vendor preset: enabled)\r\nActive: active (running) since Wed 2019-09-18 07:14:31 EDT; 5min ago\r\nDocs: https:\/\/docs.docker.com\r\nMain PID: 17988 (dockerd)\r\nTasks: 8\r\nMemory: 91.0M\r\nCGroup: \/system.slice\/docker.service\r\n\u2514\u250017988 \/usr\/bin\/dockerd -H fd:\/\/ --containerd=\/run\/containerd\/containerd.sock<\/pre>\nYou can also check the information about Docker with the following command:<\/p>\n
sudo docker info<\/pre>\nYou should get the following output:<\/p>\n
Client:\r\nDebug Mode: false\r\n\r\nServer:\r\nContainers: 0\r\nRunning: 0\r\nPaused: 0\r\nStopped: 0\r\nImages: 1\r\nServer Version: 19.03.2\r\nStorage Driver: overlay2\r\nBacking Filesystem: extfs\r\nSupports d_type: true\r\nNative Overlay Diff: true\r\nLogging Driver: json-file\r\nCgroup Driver: cgroupfs\r\nPlugins:\r\nVolume: local\r\nNetwork: bridge host ipvlan macvlan null overlay\r\nLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog\r\nSwarm: inactive\r\nRuntimes: runc\r\nDefault Runtime: runc\r\nInit Binary: docker-init\r\ncontainerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb\r\nrunc version: 425e105d5a03fabd737a126ad93d62a9eeede87f\r\ninit version: fec3683\r\nSecurity Options:\r\napparmor\r\nseccomp\r\nProfile: default\r\nKernel Version: 4.19.0-5-amd64\r\nOperating System: Debian GNU\/Linux 10 (buster)\r\nOSType: linux\r\nArchitecture: x86_64\r\nCPUs: 1\r\nTotal Memory: 987.5MiB\r\nName: debian\r\nID: DNIZ:KB6U:H3MN:RURG:G2DW:PGSF:2TIS:OPCF:RSNQ:RCGR:ZOCC:U6MF\r\nDocker Root Dir: \/var\/lib\/docker\r\nDebug Mode: false\r\nRegistry: https:\/\/index.docker.io\/v1\/\r\nLabels:\r\nExperimental: false\r\nInsecure Registries:\r\n127.0.0.0\/8\r\nLive Restore Enabled: false<\/pre>\n<\/span>Step 2a: Install a Specific Version of Docker<\/span><\/h2>\nIn some cases, you need to install a specific version of Docker on your system. In this case, first list the available versions of Docker by running the following command:<\/p>\n
sudo apt-cache madison docker-ce<\/pre>\nYou should see all the available version of Docker in the following output:<\/p>\n
docker-ce | 5:19.03.2~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:19.03.1~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:19.03.0~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.9~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.8~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.7~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.6~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.5~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.4~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.3~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.2~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.1~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 5:18.09.0~3-0~debian-buster | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.06.3~ce~3-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.06.2~ce~3-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.06.1~ce~3-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.06.0~ce~3-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.03.1~ce-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 18.03.0~ce-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 17.12.1~ce-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages\r\ndocker-ce | 17.12.0~ce-0~debian | https:\/\/download.docker.com\/linux\/debian buster\/stable amd64 Packages<\/pre>\nNext, you can install your desired version of Docker with the following command:<\/p>\n
sudo apt-get install docker-ce=<\/pre>\nYou can replace the with the version you want to install as shown in the above list.<\/p>\n
For example:<\/p>\n
sudo apt-get install docker-ce=18.03.1~ce-0~debian<\/pre>\n<\/span>Step 4: Run the Docker Command Without Sudo<\/span><\/h2>\nBy default, you will need to run Docker command with sudo privileges. If you want to run Docker command without specifying the sudo command, then you will need to add your username to the Docker group.<\/p>\n
You can add your username to the Docker group with the following command:<\/p>\n
sudo usermod -aG docker username<\/pre>\nNow, log out from the server and log in again with your username to apply for the new group membership. Now, you can run any Docker command without specifying sudo with Docker.<\/p>\n
<\/span>Working with Docker<\/span><\/h2>\nAt this point, Docker is installed and running on your system. Now, we will learn how to pull an image and run the container with Docker.<\/p>\n
First, search all the images available for the Debian operating system with the following command:<\/p>\n
docker search debian<\/pre>\nYou should see all the images in the following output:<\/p>\n
NAME DESCRIPTION STARS OFFICIAL AUTOMATED\r\nubuntu Ubuntu is a Debian-based Linux operating sys\u2026 9956 [OK]\r\ndebian Debian is a Linux distribution that's compos\u2026 3214 [OK]\r\narm32v7\/debian Debian is a Linux distribution that's compos\u2026 60\r\nitscaro\/debian-ssh debian:jessie 25 [OK]\r\narm64v8\/debian Debian is a Linux distribution that's compos\u2026 21\r\nsamueldebruyn\/debian-git a minimal docker container with debian and g\u2026 21 [OK]\r\ni386\/debian Debian is a Linux distribution that's compos\u2026 10\r\nmultiarch\/debian-debootstrap multiarch ports of debian-debootstrap 9\r\neboraas\/debian Debian base images, for all currently-availa\u2026 8 [OK]\r\nvergissberlin\/debian-development Docker debian image to use for development, \u2026 6 [OK]\r\ndebian\/eol End of Life Debian versions (pointing at arc\u2026 5\r\nsmartentry\/debian debian with smartentry 4 [OK]\r\nppc64le\/debian Debian is a Linux distribution that's compos\u2026 4\r\nvicamo\/debian Debian docker images for all versions\/archit\u2026 3\r\ns390x\/debian Debian is a Linux distribution that's compos\u2026 2\r\narm32v5\/debian Debian is a Linux distribution that's compos\u2026 2\r\nvpgrp\/debian Docker images of Debian. 2\r\nholgerimbery\/debian debian multiarch docker base image 1\r\ndockershelf\/debian Repository for docker images of Debian. Test\u2026 1 [OK]\r\nfleshgrinder\/debian Debian base images for production and multis\u2026 0 [OK]\r\nspritsail\/debian-builder A Docker image based on debian:slim ideal fo\u2026 0 [OK]\r\ncasept\/debian-amd64 A debian image built from scratch. Mostly fo\u2026 0\r\namd64\/debian Debian is a Linux distribution that's compos\u2026 0\r\njdub\/debian-sources-resource Concourse CI resource to check for updated D\u2026 0 [OK]\r\n1and1internet\/debian-9-nginx-php-7.2-wordpress-4 debian-9-nginx-php-7.2-wordpress-4 0<\/pre>\nNow, download the latest version of the Debian image from the above list with the following command:<\/p>\n
docker pull debian<\/pre>\nOnce downloaded, you should get the following output:<\/p>\n
Using default tag: latest\r\nlatest: Pulling from library\/debian\r\n4a56a430b2ba: Pull complete\r\nDigest: sha256:e25b64a9cf82c72080074d6b1bba7329cdd752d51574971fd37731ed164f3345\r\nStatus: Downloaded newer image for debian:latest\r\ndocker.io\/library\/debian:latest<\/pre>\nYou can also list the downloaded image with the following command:<\/p>\n
docker images<\/pre>\nYou should get the following output:<\/p>\n
REPOSITORY TAG IMAGE ID CREATED SIZE\r\ndebian latest c2c03a296d23 6 days ago 114MB<\/pre>\nNow, run a container using the latest Debian image with the following command:<\/p>\n
docker run -it debian<\/pre>\nYou should get the shell interface of a Debian container:<\/p>\n
root@114ef7960999:\/#<\/pre>\nYou can exit from the container with the following command:<\/p>\n
root@114ef7960999:\/#exit<\/pre>\nYou can also list your active or inactive container with the following command:<\/p>\n
docker ps -a<\/pre>\nOutput:<\/p>\n
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\n114ef7960999 debian \"bash\" About a minute ago Exited (0) 16 seconds ago sharp_booth<\/pre>\nYou can also start the Debian container by specifying Container ID (114ef7960999) as shown below:<\/p>\n
docker container start 114ef7960999<\/pre>\nNow, attach the shell interface of a Debian container with the following command:<\/p>\n
docker attach 114ef7960999\r\nOutput:\r\nroot@114ef7960999:\/#<\/pre>\nDelete a Docker Container and Image<\/h3>\n You can easily remove unused containers and images that consume significant disk space.<\/p>\n
To remove the Docker container, first list all the container with the following command:<\/p>\n
docker container ls -a<\/pre>\nYou should see the following output:<\/p>\n
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\n114ef7960999 debian \"bash\" 19 hours ago Exited (0) 19 hours ago sharp_booth<\/pre>\nNext, if your container is running, you will need to stop the container before removing it.<\/p>\n
You can stop the running container with the following command:<\/p>\n
docker container stop 114ef7960999<\/pre>\nNext, remove the container with the following command:<\/p>\n
docker container rm 114ef7960999<\/pre>\nYou can also remove all stopped containers by just running the following command:<\/p>\n
docker container prune<\/pre>\nYou should see the following warning message:<\/p>\n
WARNING! This will remove all stopped containers.\r\nAre you sure you want to continue? [y\/N] y<\/pre>\nType y and hit Enter to continue:<\/p>\n
Deleted Containers:\r\n114ef7960999f41bb9c4bba2cf5c28e425a00175ab20ed739213f16961b3897e\r\n\r\nTotal reclaimed space: 35B<\/pre>\nTo remove the Docker image, you will need to find the ID of the image you want to remove.<\/p>\n
You can find the image ID with the following command:<\/p>\n
docker image ls<\/pre>\nOutput:<\/p>\n
REPOSITORY TAG IMAGE ID CREATED SIZE\r\ndebian latest c2c03a296d23 7 days ago 114MB<\/pre>\nNow, remove the image with the following command:<\/p>\n
docker image rm c2c03a296d23<\/pre>\nYou should get the following output:<\/p>\n
Untagged: debian:latest\r\nUntagged: debian@sha256:e25b64a9cf82c72080074d6b1bba7329cdd752d51574971fd37731ed164f3345\r\nDeleted: sha256:c2c03a296d2329a4f3ab72a7bf38b78a8a80108204d326b0139d6af700e152d1\r\nDeleted: sha256:78c1b9419976227e05be9d243b7fa583bea44a5258e52018b2af4cdfe23d148d<\/pre>\nNote: To remove the image, you will have to remove the container first.<\/p>\n
You can also remove all unused images at a time by just running the following command:<\/p>\n
docker image prune -a<\/pre>\nIn the above tutorial, we have learned how to install Docker on a Debian 10 VPS. We have also learned how to pull an image, run container, start and stop the container.<\/p>\n
\n Of course, you don\u2019t have to know how to install Docker on Debian 10 if you have a Managed Debian 10 VPS<\/a> with us. You can simply ask our administrators to install Docker on Debian 10 for you. They\u2019re available 24\/7 and will be able to help you with the installation of Docker on Debian 10.<\/p>\nPS<\/strong>.<\/span> If you enjoy reading this blog post on how to install Docker on Debian 10<\/strong>, feel free to share it on social networks using the shortcuts below, or simply leave a comment.<\/p>\n","protected":false},"excerpt":{"rendered":"In this tutorial, we will learn how to install and use Docker on a Debian 10 VPS. Docker is a … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":32276,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1700,13],"tags":[1836,1794],"yoast_head":"\nHow to Install Docker on Debian 10 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n