In this post, I will show you how to install Docker on Ubuntu Server 16.04 to enable apps in containers. Confused or don't know what I am talking about? Please read my previous post on what is docker and how it compares to Virtual Machines. In short, Docker is a new way of running applications on your server by using less resources than a standard setup. It allows users to install applications inside Docker containers and run them effortlessly, isolated from the OS. The isolation helps destroy and create app containers in minutes without affecting the base OS. Due to this containerization has been increasing in popularity. Without further ado, let us see how to easily install Docker on Ubuntu 16.04 variants, including Server edition.
Must Read: Ultimate Smart Home Media Server with Docker and Ubuntu 18.04 – Basic
Table of Contents
Install Docker on Ubuntu
It takes only a few simple steps to setup Docker on Ubuntu: add sources, install prerequisites, and finally install docker engine. In this Ubuntu Docker installation guide, I have broken this down to smaller steps to help you. Ready to roll? Open your commandline terminal and proceed.
Before you begin, enable Intel VT-x hardware virtualization in BIOS or UEFI firmware. This is required for Docker to run.
1. Update Sources and Install Docker Pre-requisites
To setup Docker on Ubuntu, run the following commands in sequence to update package information, install appropriate CA certificates, and install pre-requisites. For Ubuntu 16.04 we will install the linux-image-extra-* kernel packages as well.
sudo apt-get update sudo apt-get install apt-transport-https ca-certificates sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
2. Add Docker Source
Next, to download and install Docker on Ubuntu Linux, you need to add Docker repository and a key to access it. Add the GPG key using the following command:
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Then, add the Docker repository for Ubuntu 16.04:
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main | sudo tee /etc/apt/sources.list.d/docker.list
Recommended HTPC / Home Server Builds:
- Best Home Theater PC Build 2017 to do it all (Plex, Kodi, NAS, Gaming)
- Best Emby Server builds 2018 – Pre-built and DIY options
- Medium Budget 4K HTPC Build 2017 for Kodi, Plex and Gaming
- Cheap 4K HTPC Build for Kodi, OpenELEC, and LibreELEC 2017
- Low Power Home Server Build 2017 for Network File and Media Storage
- Best HTPC for Kodi with 4K on a Medium Budget 2017 (~$400)
- Energy efficient budget HTPC-NAS combo build 2016
3. Setup Docker on Ubuntu
Now you are ready for Ubuntu Docker installation. First, update APT package index:
sudo apt-get update
Next, verify if APT is connecting to the correct Docker repository:
apt-cache policy docker-engine
You should see an output like what is shown below:
Finally, install Docker on Ubuntu using the following command:
sudo apt-get install docker-engine
Recommended Guides:
4. Start and Verify Docker
Now that docker installation on Ubuntu is complete, start it using the following command:
sudo service docker start
Finally, verify if Docker is installed correctly by running the following command:
sudo docker run hello-world
You should see an output like what is shown below:
5. Configure Docker to start on boot
Docker does not automatically start during booting on Ubuntu. Ubuntu uses systemctl
to autostart services. In order to configure Docker to autostart on boot, run the following command:
sudo systemctl enable docker
After running the command, Docker will start automatically after each system reboot.
Docker is installed successfully. What to do next?
If everything went well, you should have Docker installed on Ubuntu, the service should be running and waiting to host containers with various apps. In the upcoming guides, we will show you how to install docker containers with apps (SickRage, Sonarr, CouchPotato, Plex, etc.) to build your home server on docker engine. This will enable you to install and manage home server software efficiently. Sounds exciting? Go ahead, install Docker on Ubuntu and get ready for the ride.