Uninstall Old Versions

$ sudo apt-get remove docker docker-engine docker.io


Install Support Drivers

If you're using version 3 of the Linux kernel, install the linux-image-extra-* packages, which allow Docker to use the aufs storage drivers.

$ sudo apt-get update $ sudo apt-get install \ linux-image-extra-$(uname -r) \ linux-image-extra-virtual


Installing Docker CE (Community Edition)

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \


Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify the key fingerprint:

$ sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22

Setup the repository:

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \

Install Docker CE

$ sudo apt-get update

$ sudo apt-get install docker-ce

To install a specific version, first get a list of all available versions:

$ apt-cache madison docker-ce


Now install specific docker version using the version name like:

$ sudo apt-get install docker-ce=<VERSION>

Verify installation:

sudo docker run hello-world


Uninstalling Docker CE

$ sudo apt-get purge docker-ce

To delete all configurations and data:

$ sudo rm -rf /var/lib/docker
Source: Docker Docs