Recommended VPS Complete list of best VPS hosting providers.

How To Install Docker On Ubuntu Server

install docker ubuntu

Docker has become more popular among developers as a platform to automate deployment of applications inside software containers within cloud servers. It is very easy for developers to deploy their applications on a Docker container, save the container image, and then, manually or automatically, deploy the application image in other Docker-enabled cloud servers without having to worry about the underlying operating system or environment settings.

It is possible to install Docker on a virtual machine running virtualization technology. In this guide, we will provide you with step-by-step instructions on how to install Docker 1.10.2 on a Ubuntu 14.04.3 LTS (64-bit) virtual machine. The example below was done on a Plan XS (1 GB) cloud server (virtual machine) hosted in SimplerCloud using root account, therefore the “sudo” command was omitted on most of the steps. If you are using a non-root user with sudo access, please append “sudo” in front of each command (e.g. “sudo apt-get update” instead of “apt-get update“).

Prerequisites for Installing Docker on Ubuntu

These are the pre-requisites for installing Docker on an Ubuntu server:

  1. A virtual machine or physical server running 64-bit installation of Ubuntu. Note that 32-bit installation of Ubuntu is not supported. Below are the Ubuntu versions officially supported by Docker:

    In this guide, we will be using Ubuntu Trusty 14.04.3 LTS (64-bit), which is the latest LTS (Long Term Support) version of Ubuntu at the time of writing this article.

  2. Minimum kernel version of Ubuntu is 3.10 or higher. To check your kernel, run “uname -r” from the virtual machine’s SSH terminal.001 - Kernel version

    Based on the above, we can see that the kernel version is 3.13, which meets the requirement. If the kernel version is lower than 3.10, upgrade the kernel first using below commands and restart the server for the changes to take effect:

    002 - apt-get dist-upgrade

    apt-get update
    apt-get dist-upgrade –y
  3. An SSH client such as Putty, and basic knowledge on how to use the SSH client to access your virtual machine.
  4. Basic knowledge on some Unix commands to access your virtual machine via SSH.

Installing Docker

Step 1 – If you haven’t done so, please update your Ubuntu OS and install the latest patches by running below commands:

apt-get update
apt-get dist-upgrade -y

Reboot your server after the update for the changes to take effect.

Step 2 – To ensure that aufs storage driver is supported by Docker, install the linux-image-extra kernel package by typing below command and reboot your server once completed :

apt-get install linux-image-extra-$(uname -r)

On the test virtual machine we are using, the linux-image-extra package is already installed by default (see screenshot below).

003 - install linux-extra-image package

Step 3 – Set your Ubuntu’s APT sources to work with https method and CA certificates are installed by running below command:

apt-get install apt-transport-https ca-certificates

Note that normally both packages are already installed by default in many Ubuntu virtual machines. Below example shows that the packages are already installed:

004 - install https support for apt

Step 4 – Add the Docker repository’s GPG keys for verification:

apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

005 - add apt key

Step 5 – Add the Docker repository into your Ubuntu’s APT sources by running below command:

echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list

006 - add apt repository

Step 6 – Run apt-get update to update your package index:

apt-get update -y

007 - apt-get update

Step 7 – Install the Docker engine by running below command:

apt-get install docker-engine

008 - install docker-engine

Type “Y” to continue, and wait until the Docker Engine installation is completed.

009 - install docker-engine 2

Step 8 – The Docker daemon should be started automatically once the installation is completed. You can verify by running below commands:

service docker status

// or..

ps awx | grep docker

010 - check docker status

Step 9 – If the Docker daemon is not started, you can start it using below command:

service docker start

011 - start docker service

Step 10 – To verify that your Docker daemon is running properly, run below docker command:

docker run hello-world

The command will try to run the hello-world default image, and to pull it from Docker library if it doesn’t exist locally.

012 - run hello-world

Congratulations! You have installed Docker on your virtual machine.

The next step is to create a Docker image and run a new Docker container (tutorial coming soon).

Disclaimer : This is a guest post article by Indra Pramana from SimplerCloud.com, a cloud servers provider from Singapore with solutions built from the ground up to provide truly real-time, scalable and easily managed cloud infrastructure for start-ups, developers and business throughout Asia.

3 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.