Install Docker on Debian 8 Jessie Server Via Official Repository
In this tutorial, I’m going to show you how to install docker on Debian 8 Jessie server. The Linux version of Docker is split into docker-engine and docker-compose.
Pre-requisites
Docker supports 64 bit system with Linux kernel 3.10+. To check whether your Debian system is 32 bit or 64 bit, use uname -m
command.
user@debian8:~$ uname -m x86_64
Debian 8 comes with a 3.16.0 Linux kernel. Use uname -r
command to check your Linux kernel version.
user@debian8:~$ uname -r 3.16.0-4-amd64
Use the following command to upgrade to the latest Linux kernel version available on Debian 8.
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
Note that if your VPS is virtualized using OpenVZ technology rather then KVM, then the kernel version might be very old and you are not allowed to upgrade kernel on OpenVZ VPS. So KVM VPS is a better choice.
Install Docker on Debian 8 Jessie Server
Add Docker GPG key.
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Create a new source file under /etc/apt/sources.list.d/
.
sudo nano /etc/apt/sources.list.d/docker.list
Add this line in the file and save the file.
deb https://apt.dockerproject.org/repo debian-jessie main
Because the docker repository requires HTTPS connection so we need to install apt-transport-https and ca-certificates package to make APT establish HTTPS connection with docker repository.
sudo apt-get install apt-transport-https ca-certificates
Update local package index and install docker on Debian 8.
sudo apt-get update && sudo apt-get install docker-engine
Start the docker service.
sudo systemctl start docker
Enable docker auto-start when Debian Jessie is booted up.
sudo systemctl enable docker
Check docker status.
systemctl status docker
Output:
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled) Active: active (running) since Fri 2016-04-15 14:55:11 EDT; 1min 3s ago Docs: https://docs.docker.com Main PID: 1992 (docker) CGroup: /system.slice/docker.service ├─1992 /usr/bin/docker daemon -H fd:// └─1995 docker-containerd -l /var/run/docker/libcontainerd/docker-c...
Verify Docker installation is working correctly with this command:
sudo docker run hello-world
If you see this message, then it’s working correctly.
Hello from Docker. This message shows that your installation appears to be working correctly.
Check Docker version.
user@debian8:~$ docker --version Docker version 1.11.0, build 4dc5990
Install docker-compose
Switch to root user. Download the docker-compose binary from Github and save it to /usr/local/bin/docker-compose.
su - curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
Make it executable.
chmod +x /usr/local/bin/docker-compose
At the time of this writing, the latest version of docker compose is 1.7.0, you may need to change the version number if you like a new version.
Check docker-compose version.
root@debian8:# docker-compose --version docker-compose version 1.7.0, build 0d7bf73
Exit out of root.
exit
Congrats! Now you have successfully installed docker on Debian 8 Jessie.
You can also add a non privileged user to the docker group to not use sudo each time: sudo gpasswd –add your_user docker (log out and in again, and you’ll be all set)
Hi, why should I install docker-compose / what would I lose by not doing it?