Pages

Tuesday, February 7, 2017

Docker Installation on Ubuntu 16.04

Introduction

Docker is a tool that automates the deployment of applications inside software containers ( Container is an operating-system-level virtualization method for running application as single processes)

Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment

OS requirements

I will be installing docker on Ubuntu and to install Docker, you need the 64-bit version of Ubuntu. You can check current version on Ubuntu using following command.

Docker Installation

Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach. This would require access to Internet from the Host

Some users download the DEB package and install it manually and manage upgrades completely manually.

Go to https://apt.dockerproject.org/repo/pool/main/d/docker-engine/ and download the .deb file for the Docker version you want to install and for your version of Ubuntu

Some users cannot use the official Docker repositories, and must rely on the version of Docker that comes with their operating system. This version of Docker may be out of date. Those users should consult their operating system documentation and not follow these procedures.

Install using the repository

Before you install Docker for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install, update, or downgrade Docker from the repository

Set up the repository

Get Docker Script - This script not only setup the repository , it perform installation of docker as well

Installation Procedure

I will be using Get Docker Script to perform the installation. # This script is meant for quick & easy install via:

curl -sSL https://get.docker.com/ | sh

or

wget -qO- https://get.docker.com/ | sh

Manage Docker as a non-root user

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 only access it using sudo. The docker daemon always runs as the root user. If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like:

sudo usermod -aG docker user

Remember that you will have to log out and back in for this to take effect!

root@MunishLabUbuntu:/# docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world78445dd45222: Pull completeDigest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7Status: Downloaded newer image for hello-world:latestHello 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 bashShare images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/For more examples and ideas, visit: https://docs.docker.com/engine/userguide/root@MunishLabUbuntu:/#