Home/How to Install and Use Docker on Ubuntu 14.04

How to Install and Use Docker on Ubuntu 14.04

Docker is an open-source program that enables a Linux application and its dependencies to be packaged as a container such as configuration files, however, unlike a virtual machine, a container doesn’t run a OS, it shares the OS of the host, which in this case will be Ubuntu 14.04.

It makes it possible to get more apps running on the same old servers by providing an additional layer of abstraction and automation of operating system level virtualization on Linux. In this article we will explain you about the installation and usage of Docker-managed release packages and its working mechanism.

Docker Requirements

In order to install Docker on Ubuntu Operating system make sure that its supported only 64-bit installation of your Ubuntu Version as its missing with some of its features on the kernels older than version 3.10.

You can check the kernel version of your installed Ubuntu kernel version with following command.

root@ubuntu-14:~# uname -r

You system should be updated so ensuring the list of available packages is up to date before installing anything new you must upgrade your kernel and install the additional packages from packet manager with following command by opening your terminal.

root@ubuntu-14:~# apt-get update

If you are using any olde version of your operating system you can upgrade it with following command.

root@ubuntu-14:~# apt-get -y upgrade

Docker Installation

Once you had fulfilled the requirements to install Docker, then we are ready to go with its installation process. The Docker’s installation was available only for Ubuntu in the past days but now its available for many other distributions like CentOS and other Red Hat distributions. Let’s install Docker by installing the docker-io package now.

root@ubuntu-14:~# apt-get -y install docker.io

Now we will create and fix the paths by creating a soft link between docker.io in /usr/local/bin/ to docker that is in the same folder with the following two commands.

root@ubuntu-14:~# ln -sf /usr/bin/docker.io /usr/local/bin/docker
root@ubuntu-14:~# sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io

Docker Services Check

To confirm the status of docker’s service, execute the following command to be sure that its service is up.

root@ubuntu-14:~# service docker.io status
docker.io start/running, process 14394

To start its daemon use the below command to be executed on the terminal and be sure its daemon is not previously in running state, if so then stop its daemon first.

root@ubuntu-14:~# docker -d &

Docker Service Auto start

Let’s make the Docker’s services up and running after each boot up, to do so run the following command to add its entry into boot startup script as:

root@ubuntu-14:~# update-rc.d docker.io defaults

Docker Usage

Now in the next session we will explain you about its usage that how we get it works for us.
To get the list of all the available commands, run the docker in the terminal and you will get a list of its all available commands with its descriptions to use.

root@ubuntu-14:~# docker

Docker Container Download

Now we will download the Docker’s image by using its docker command with pull options to Pull an image or a repository from the Docker registry server. Here is its command to use.

root@ubuntu-14:~# docker pull ubuntu

Here is its running snapshot that will take a while during the downloading process of its whole packages.

Running a Docker Container

Now, let’s see how we can easily setup our Ubuntu container with a bash shell, we will just run the one command as below where the docker runs a command in a new container, -i attaches stdin and stdout while –t assigns a tty.

root@ubuntu-14:~# docker run -i -t ubuntu /bin/bash

So, in the output we can see the standard Ubuntu container that can be used.

So, we are now using a bash shell inside of an Ubuntu docker container. If you wish to disconnect, or detach, from the sDocker container’s shell without exiting from it we have to use the with combination of these keys Ctrl-p + Ctrl-q , then you will be back to your previous window.

Docker Group

Let’s create the a group with name docker and put your users in this user to avoid using the root user as the docker user has the same privileges like the root. So, we create the new group with following command.

root@ubuntu-14:~# usermod -aG docker ubuntu

Now exit from your current session and relogin with your docker to check if its working fine.

Docker Test

Run the following command to check the output, if its fine or not.

docker@ubuntu-14:/root$ docker run hello-world

So, the output shown in snapshot shows that docker user is functional and is working fine with both the root as well as docker user.

Docker Available Containers

The available containers can be found through a search command as there are many community containers already available. Let’s see how we can search for any of the available containers by using the following command where I put centos to search for its docker container.

root@ubuntu-14:~# docker search centos


After going through this detailed article you are now able to setup and use Docker containers for any of your operating system by checking its availability. So, we hope you have had a pretty good tour through what Docker is and how it works, but still there are many challenges to setup Docker in the Organizations. Feel free to get back to us in case of any difficulty, as we feel pleasure to assist you.

Sign up now to get a free cloud strategy session with our experts.

Spend 30 minutes with our experts to listen to your business challenges and discuss how to design, migrate and/or architect your cloud solution to help you meet your objectives.

Sign Up Now
July 21st, 2015|0 Comments