Install Docker, Docker-machine and docker-compose on Debian 10

Go to the profile of  CloudResources
CloudResources
3 min read

This guide will help you installing Docker,Docker-machine and Docker-compose on Debian 10 (buster).

What is Docker?

Docker is a free and open-source containerization software that helps to deploy, run applications in a container. The containers are similar to a virtual machine but consume fewer resource, easy to manage and can run anywhere regardless of operating environment it is running in.

Docker uses cgroups and namespace to allow the independent containers to run within a single Linux instance.

Note: Docker needs a 64-bit version of Debian OS and Kernel version should be at least 3.10.

Table of contents

  1. Setup Docker Repository
  2. Prepare Docker Repository
  3. Update apt database
  4. Install Docker
  5. Install docker machine
  6. Install docker compose

Setup Docker Repository

Before start the installation, please ensure you have root access right of Debian system.To install Debian 10 system, you can see How to Install Debian 10 (Buster)

  1. Login Debian server as root
  2. Disable CDrom repository
    • Edit /etc/apt/sources.list
    • Comment below line
      #deb cdrom:[Debian GNU/Linux 10.0.0 _Buster_ - Official amd64 DVD Binary-1 20190706-10:24]/ buster contrib main
  3. Execute below to commands to install necessary packages first
apt-get update
apt-get install -y apt-transport-https ca-certificates software-properties-common curl gnupg

Prepare Docker Repository

Add the GPG key for Docker repository on your system.

wget https://download.docker.com/linux/debian/gpg 
apt-key add gpg

debian_10_gpg

Add the official Docker repository to the system by running below command in the terminal

echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" |  tee -a /etc/apt/sources.list.d/docker.list

Update apt database

apt-get update

Make sure you are installing Docker from the official repository, not from the default Debian repository.

Install Docker

  1. Install Docker using the apt-get command
    apt-get -y install docker-ce

Wait for the installation finish

Verify Docker Installation

Type docker version in the terminal, you can see something like below

debian_10_docker_version

Install docker machine

What is Docker Machine?

Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands. Using docker-machine commands, you can start, inspect, stop, and restart a managed host, upgrade the Docker client and daemon, and configure a Docker client to talk to your host. More detail can refer to Docker Machine Overview

Docker Machine Installation

Type below commands to install docker machine

curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine && cp /tmp/docker-machine /usr/local/bin/docker-machine

Verify Docker Machine

To verify installation successfully, type "docker-machine" at the terminal and it will show the version of docker machine.

docker-machine version 0.13.0, build 9ba6da9

debian_10_docker_machine_version

Install docker compose

What is Docker Compose?

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see Overview of Docker Compose.

Docker Compose Installation

Type below commands to install docker compose

curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Verify Docker Compose

To verify installation successfully, type "docker-compose version" at the terminal and it will show the version of docker compose.

debian_10_docker_compose_version

Reference