There are two ways to install Docker CE (Community Edition): using its repository or by directly installing its package file. Using the repository is highly recommended.
Repository install: Follow the steps listed here to do this.
Package install: Go to https://download.docker.com/linux/ubuntu/dists/. Pick your Ubuntu version. 16.04 is Xenial for example. Then pick
pool/stable/amd64/ and then download the latest DEB files for docker-ce-cli, containerd.io and docker-ce. Install these packages in the same order.
Remember to add your username to the
$ sudo adduser joe docker
You will need to logout and login for the group assignment to take effect. If you find that logout-login to be painful, try this trick.
Try Docker and see if it works:
$ docker run hello-world
Tried with: Docker 17.09 and Ubuntu 16.04