Installing Docker on Ubuntu 14.04

Published on: Thu, Aug 13, 2015 at 4:39 am EST
Containers Server Apps Ubuntu

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 on Ubuntu 14.04.

Step 1: Updating all your software

First off, let's make sure that we are using a clean system. Run the apt updater.

apt-get update

Step 2: Installing Docker

Install Docker on your system. This will add the needed repositories and install the software.

apt-get -y install docker.io
ln -sf /usr/bin/docker.io /usr/local/bin/docker
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io

Step 3: Create a user

If you decide not to run Docker as the root user, you will need to create a non-root user.

adduser user
usermod -aG docker user

Restart the Docker service.

service docker.io restart

Step 4: Test 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.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

Lastly, enable Docker to run when your system boots.

update-rc.d docker.io defaults

Congratulations! You have successfully installed Docker. For further reading, see this guide where I explain how to create and use Docker containers.

Want to contribute ?

You could earn up to $300 by adding new articles