DOCKER ON UBUNTU 14.04

Introduction

Docker is a container-based software framework for automating deployment of applications. “Containers” are encapsulated, lightweight, and portable application modules.Docker is a container virtualization technology that has gained widespread popularity in recent times, it offers more efficient way to deploy the application. With Docker, the applications resides inside the container on top of the Linux operating system. Docker uses Kernel features such as cgroups and namespace to allow independent container to run on single os instance.

Note: Docker runs only on 64 bit operating system.

This page instructs you to install using Docker-managed release packages and installation mechanisms.

Prerequisites

Docker requires a 64-bit installation regardless of your Ubuntu version. Additionally, your kernel must be 3.10 at minimum. The latest 3.10 minor version or a newer maintained version are also acceptable.

Kernels older than 3.10 lack some of the features required to run Docker containers. These older versions are known to have bugs which cause data loss and frequently panic under certain conditions.

To check your current kernel version, open a terminal and use (uname -r) to display your kernel version:

$ uname -r
3.11.0-15-generic

Update your apt sources

Docker’s apt repository contains Docker 1.7.1 and higher. To set apt to use packages from the new repository:

1- Add GPG KEY

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

2- Open the /etc/apt/sources.list.d/docker.list file in your VIM editor.

$ sudo vim /etc/apt/sources.list.d/docker.list (if not created then create it)

3- Remove any existing entries.

4- Add an entry for your Ubuntu 14.04 operating system as per given following .

deb https://apt.dockerproject.org/repo ubuntu-trusty main

5- Save and close the /etc/apt/sources.list.d/docker.list file.

6- Update the apt package index.

$ sudo apt-get update

7- Verify that apt is pulling from the right repository.

$ sudo apt-cache policy docker-engine

From now on when you run apt-get upgrade, apt pulls from the new repository.

Install linux-image-extra

Note – : For Ubuntu Precise, Docker requires the 3.13 kernel version. But If your kernel version is older than 3.10, you must upgrade it.

For Ubuntu Trusty, Vivid, and Wily, it’s recommended to install the linux-image-extra kernel package. The linux-image-extra package allows you use the aufs storage driver.

To install the linux-image-extra package for your kernel version:

1- Open ubuntu Terminal

2- Update Package Manager

$ sudo apt-get update

3- Install Recommended package.

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

Now Go ahead and install Docker.

Installation OF Docker –

Make sure you have installed the prerequisites for your Ubuntu version. Then, install Docker using the following:

1- Log into your Ubuntu installation as a user with sudo privileges.

2- Update your apt package index.

$ sudo apt-get update

3- Install Docker.

$ sudo apt-get install docker-engine

4- Start the docker daemon.

$ sudo service docker start

5- Verify docker is installed correctly.

$ sudo docker run hello-world ( This command will give following output )

Create a Docker group

The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user.

To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

To create the docker group and add your user:

1- Log into Ubuntu as a user with sudo privileges.

This procedure assumes you log in as the ubuntu user.

2- Create the docker group and add your user.

$ sudo usermod -aG docker ubuntu

3- Log out and log back in.

This ensures your user is running with the correct permissions.

5- Verify your work by running docker without sudo.

$ docker run hello-world

*******************************************ENJOY***************************************************

Loading Facebook Comments ...

Lascia un commento