Docker: A New way to Deploy the Application

Introduction:

In this post we will focus on understanding the containerization with Docker.

Containerization with Docker:

Deployment of an application is a tedious job. Only a single application need’s to be deployed on a single physical machine. Virtualization made its possible to deploy different applications on a single machine. Virtualization is one of the important concepts in a cloud. Each virtual machine has its own environment. Hyper-visor is used to implement hyper-visor level virtualization. But in this type of virtualization each VM requires its own resources like CPU , Memory, and Guest Operating Systems.

Another concept is container level virtualization, aka. containerization. In container level virtualization, an OS kernel is used for creation of guest instances. Each guest instance consists of its own processes, memory, and file system. It’s like a VM, but not actually a VM. It’s a lightweight container which is running with file systems and necessary resources which is required by the application.

Docker is a container level virtualization. It creates images of applications and runs it on a physical server. Each running image is called a container.

To do this, it requires a Docker file which consists set of instructions.

Docker file:

FROM ubuntu:14.04
RUN apt-get -y update && apt-get install -y curl

First line will search the ubuntu:14.04 image locally. If its not available, then it will download it from the official image of ubuntu. By default it downloads from docker hub. Second command updates ubuntu and also it will install curl.

To make an image of this docker file:

$ docker build -t docker/ubuntuimg:1.0 .

Don’t forgot the .(dot) at the end. Here docker is command and build is sub-command with option -t which allows you to create a docker image. Also, docker/ubuntuimg is the name of a repository of the image. 1.0 is a tag which shows the version of the image. If the version is not specified, the docker takes the latest as default.

Run the image:

$ docker run -it docker/ubuntuimg:1.0

Docker is the command and run is the subcommand. The -it instructs Docker to allocate a pseudo-TTY connected to the container’s stdin; creating an interactive bash shell in the container.

Check running images with:

$ docker ps

This is all about installing, creating a image, and running container with docker. Check our latest blogs here.