We’ll show you how to install Docker on your Ubuntu 16.04 server. Short and straight-to-the-point tutorial.
With Docker, you can build, ship and run applications inside your server in containers. Essentially, with Docker, you get “virtual machines” inside your virtual machine.
You can’t run Docker on just about any server. Here are the requirements:
- 64-bit server.
- At least 512MB RAM.
- Linux Kernel 3.10+. Latest version recommended.
- An Ubuntu 16.04 VPS (for the purposes of this tutorial). You can get one from Vultr, starting from $2.5 a month. Note that you can’t run Docker on an OpenVZ VPS.
Update your server
Always update your server before doing anything. Run the following command:
sudo apt-get update && apt-get upgrade -y
Install the latest version of Docker
If you use Ubuntu’s default repositories, you may not get the latest version of Docker, so to get the latest one, follow the steps below.
Add the key for the official Docker repository to your Ubuntu system:
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Add the GPG key to your Ubuntu apt repository:
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
Now update your package’s list to get the latest Docker version in your repositories:
sudo apt-get update
Run the following command to make sure that you install the latest version of Docker you just added, not the default Ubuntu one:
apt-cache policy docker-engine
And now install Docker by running:
sudo apt-get install docker-engine -y
Wait a bit, and that’s it. Docker is officially installed on your Ubuntu 16.04 or Ubuntu 18.04 (64-bit) VPS.
To verify that Docker is installed, run the following command:
sudo systemctl status docker
To see which Docker commands you can run, enter this command:
docker run --help
Or check the official documentation.