Docker is an application that allows to deploy programs that are run as containers. It was written in the popular Go programming language. This tutorial explains how to install Docker CE on Ubuntu 16.04.
First off, let's make sure that we are using a clean system. Run the apt updater.
Install packages to allow apt to use a repository over HTTPS
apt-get install apt-transport-https ca-certificates curl software-properties-common
Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
Use the following command to set up the stable repository.
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update apt-get install docker-ce
If you decide not to run Docker as the root user, you will need to create a non-root user.
Warning: The docker group grants privileges equivalent to the root user.
adduser user usermod -aG docker user
Restart the Docker service.
systemctl restart docker
Run the Docker hello-world container to test if the installation completed successfully.
docker run hello-world
You will see the following output.
Hello from Docker!
This message shows that your installation appears to be working correctly.
Lastly, enable Docker to run when your system boots.
systemctl enable docker
Congratulations! You have successfully installed Docker. For further reading, see this guide where I explain how to create and use Docker containers.