Adding the Docker repository to APT sources

For Ubuntu 16.04, add the following:

$ echo "deb ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list

For Ubuntu 18.04, add the following:

$ echo "deb 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 ...

Get Robot Operating System Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.