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

Last updated on January 30, 2016 by Dan Nanni

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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean