For Ubuntu 16.04, add the following:
$ echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
For Ubuntu 18.04, add the following:
$ echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
Updating the package database with the Docker packages from the newly added repository is done as follows:
$ sudo apt-get update
Make sure that we are about to install from the Docker repository instead of the default Ubuntu repository:
$ apt-cache policy docker-engine
Notice that docker-engine is not installed yet; to install docker-engine, use the following command:
$ sudo apt-get install -y docker-engine ...