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.
This guide will help you installing Docker on Debian 9 Stretch. This guide should also work on the previous version, i.e., Debian 8 (Jessie)
Note: Docker needs a 64-bit version of Debian OS and Kernel version should be at least 3.10.
Table of contents
- Setup Docker Repository
- Prepare Docker Repository
- Update apt database
- Install Docker
- Install docker machine
- Install docker compose
Setup Docker Repository
Before start the installation, please ensure you have root access right of Debian system. If still have no Debian system, you can install debian 9 stretch at the beginning
- Login Debian server as root
- 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
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
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
Make sure you are installing Docker from the official repository, not from the default Debian repository.
- Install Docker using the
apt-get -y install docker-ce
Wait for the installation finish
Verify Docker Installation
docker version in the terminal, you can see something like below
Client: Version: 17.12.0-ce API version: 1.35 Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:11:19 2017 OS/Arch: linux/amd64 Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.12) Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:09:54 2017 OS/Arch: linux/amd64 Experimental: false
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 by typing "docker-machine"
docker-machine version 0.13.0, build 9ba6da9
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 by typing "docker-compose version"
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016