How to upgrade Docker on Debian or Ubuntu using the official source

Question: I installed Docker from the base repository of my distro, which seems to be out-of-date. How can I upgrade Docker on [Ubuntu or Debian], preferably using the official source?

While Debian, Ubuntu or their derivatives offer Docker in their base repositories, the version of their Docker tends to be quickly outdated as Docker has been under active development. For example, Ubuntu 15.10 comes with Docker 1.6.2, while the latest Docker is version 1.9.1 as of this writing. Older-version Docker may have issues with communicating with existing Docker repositories.

For those of you who want to upgrade your Docker to the latest version on Debian-based systems, Docker provides official apt sources for different releases.

Here is how to upgrade Docker using the official apt source.

First, install the necessary repo key.

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Then add the apt source of your distribution as follows.

For Ubuntu (12.04 LTS, 14.04 LTS, and 14.10 or higher):

$ sudo sh -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -sc) main' | cat > /etc/apt/sources.list.d/docker.list"

For Debian (7.0 and higher):

$ sudo sh -c "echo 'deb https://apt.dockerproject.org/repo debian-$(lsb_release -sc) main' | cat > /etc/apt/sources.list.d/docker.list"

Next, remove existing Docker installation and clean up related configuration.

$ sudo apt-get purge docker.io

Finally, install the latest Docker from the official source.

$ sudo apt-get update; sudo apt-get install docker-engine

Verify the version of Docker that you installed.

$ docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:16:54 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:16:54 UTC 2015
 OS/Arch:      linux/amd64

Note that on Ubuntu, an alternative way to upgrade Docker is via Canonical's PPA repository for Docker. While the Canonical's PPA repository maintains more recent Docker versions than Ubuntu's base repositories, it still falls behind the official Docker's apt sources.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *