• Blog Home
  • Tech Talk
    • Best Practices
    • Java
    • .NET
    • Mobile
    • UI/ UX
    • Systems Engineering
    • Quality Assurance
  • ClubM

Sign in

  • Mazarin Corporate Site »
Mazarin Blog
stay connected
Join us on Facebbook! Follow Us on Twitter! Subscribe to our RSS Feed!
Jun
26
2017
Java // Tech Talk

What is Docker ? Getting Started with Docker

Author Article by Admin editor    Comments No Comments

Docker is an open platform, which can be used for developing, shipping and running applications. Docker is designed to deliver an application fast by separating the application from the infrastructure.

Practically, it is a challenging task to create the exact same infrastructure in different environments in software development. Therefore, lots of issues occur during deployment and testing processes.

“It works on my machine, but it doesn’t work in production”, is a very common statement heard in the industry and it happens due to people using different infrastructure configurations in different environments, to deploy their artifact.

Therefore, industry professionals came up with various solutions and one of those is based on container base virtualization. A container creates an isolated environment using the kernel of the host operating system. Each container provides an isolated environment for each application. It uses container-based virtualization and the Docker engine creates and manages containers and provides a way to run the application in an isolated container.

It is an open platform, which can be used for developing, shipping and running applications. It is designed to deliver an application fast by separating the application from the infrastructure. it helps to ship, test and deploy code faster and shortens the cycle between writing and running code.

At its core, Docker provides a way to run almost any application securely isolated in a container. The isolation and security allows for running many containers simultaneously on the host server. Because of the lightweight nature of containers, it runs without the extra load of a hypervisor, so that Docker facilitates to get more out of the hardware.

 

Containers Architecture

Figure 1: Containers Architecture (Image source: www.docker.com)

When it comes to practical usage, It builds and run the environment on its own. Docker creates the same environment and infrastructure on a local machine, staging and production server.

Docker Environment
Figure 2: Docker Environment

In terms of interaction, Docker uses the client-server architecture.  Docker-daemon is a Docker server which enables a container to be built, shipped and run. Docker client takes user input and sends it to the Docker-daemon where it builds, runs and distributes containers. Client and server can run on the same host or different hosts.  In order to check client and server version “docker version” command can be executed.

Docker Daemon and Docker Client
Figure 3: Docker-Daemon and Docker Client (Image source: www.docker.com)

To understand Docker’s internals, you need to know about following workflow components. They are Dockerfile, Docker-image, container and Docker registry.

Dockerfile is a text file. It contains all the commands which are needed to create a Docker-image. Dockerfile offers many advantages for developers such as,

– Creating images using Dockerfiles is flexible because default options can be overridden

– Versioning has become easy with Dockerfile since you commit the Dockerfiles to version control to keep track of changes.

– Dockerfiles provide accountability when it comes to sharing images, so that others will be able to inspect the process of creating the image etc.

Docker-image is a read-only template which is used to create Docker-containers. Within the image, there are set of instructions for creating a container, like what programs to install, what folders and files to create etc. Developers can create their own images or use images that have been developed by others. Images are stored in the local registry or public registry. An image can be modified to create other images. The definition of an image is contained in a text file with a structured syntax referred to as a Dockerfile.

Docker-container is an isolated platform environment and it is a running instance of the image. Therefore, a Docker-container can be treated as a runtime object.  Inside the Docker-container, it has everything that is required to run applications and containers can have one or more images. Using the command line interface or Docker API. Docker-containers can be started,stopped, moved or deleted.

Docker registry is the place which store Docker-images and it contains Docker repositories. and these repositories have Docker images. Docker hub is the public registry that contains many images for use. It has many official repositories and also has user specific repositories. These repositories have an introduction about repositories, instructions about how to use images and tags of various images in the repository.

 

Workflow of the Docker Components
Figure 4: Workflow of the Docker Components

Docker-images can be downloaded to the local machine by pulling them from the Docker registry. The customization for the Docker-image can be done by editing the Dockerfile, since Dockerfile contains all the commands that are needed to create a Docker-image.  A new Docker-image can be created by commenting the Dockerfile and the new Docker-image can be stored in the local registry or pushed to a public registry.

Docker-image will create the container and run the application and Docker-images are read-only templates from which Docker-containers are launched and each image consists of a series of layers. Every Docker-image starts from a base image. An example is that the base image may be Ubuntu or Apache depending on the need. Docker-images are created based on a set of instruction and each instruction creates a new layer in the Docker-image. All these instructions are stored in a file called Dockerfile. When an image create request is executed, these instructions are executed and generates the final image.

These Docker-images can be stored in Docker registry. A Docker-images can be pushed to a public registry such as a Docker hub or own registry in the local environment. That image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data as needed.

Docker CLI facilitates to create, configure and run a Docker-image.  Below are some basic Docker commands and their usages.

docker: This command will list down all the available Docker commands.
docker version: Show Docker client and server(daemon) information.
docker build: Build Docker image.
docker images: List down all the images in local registry.
docker ps: List down running Docker-containers.
docker run: Run Docker image.

Following image shows how to create a container using standard Tomcat.

 

References

  • https://blog.xenproject.org/2015/08/11/will-docker-replace-virtual-machines/
  • https://www.youtube.com/watch?v=mt5NDVK0Eg&index=6&list=PLaZW_dTdSDq6lfJJuvjz2wWHh8c3CSzvS
  • https://www.docker.com/
  • https://www.docker.com/what-docker

 

Authors

  • Lahiru Nanayakkara
  • Savani Samarathunga

Related Post

How to Succeed With Designing Scalable Web Apps
What is NFC – The Ultimate Guide
An Introduction to Node.js – Kickstarter
Productive Development With React Redux
Company Culture
Let’s move to NoSQL Databases with MongoDB – Mazarin
5 Principles: How To Use Lean Startup Towards A Successful Project
How to use SoapUI NextGenPro to test RESTful web services?
Tags: Container Base Virtualization, Developing Applications, Docker, Mazarin, Open Platform, Running Applications, Shipping Applications
Did you enjoy reading this article? Share it! Share on Facebook Tweet this! Bookmark on Delicious StumbleUpon Digg This!

Related Posts

  • Serverless Architecture with AWS Lambda
  • Let’s move to NoSQL Databases with MongoDB – Mazarin
  • Without Redux and with Redux application state behaviorProductive Development With React Redux
  • Elements of CultureCompany Culture
avatar

About the Author:

Leave a comment

Click here to cancel reply.

CAPTCHA
Refresh

*

Follow Us on Twitter!

Related Post

Sass and LESS: An Introduction to CSS Preprocessor...
Azure Functions – Learn more about it
Firebase – Mobile Application Development &#...
Serverless Architecture with AWS Lambda
Let’s move to NoSQL Databases with MongoDB &...
Productive Development With React Redux
Beginners’ Guide to CSS (CSS for dummies)
Company Culture
Hybrid Mobile App Development with Ionic and Angul...
Test Automation of Mobile Applications using Appiu...
What Power BI Can Do – Major Benefits
Data Mining using SQL Server Analysis Server
Learn Cucumber Test Automation with Ruby Core Fram...
How to Succeed With Designing Scalable Web Apps
Importance of Big Data and Managing Data with Elas...
An Introduction to Node.js – Kickstarter
MS SQL Server BI (Business Intelligence)
How To Start Cloud Computing with AWS
What is NFC – The Ultimate Guide
5 Principles: How To Use Lean Startup Towards A Su...
Avatars by Sterling Adventures

Team Mazarin

A team of individuals dedicated to share common goals and vision of the company. Mazarin's endowed team consists of Managers, Software Engineers, User Interface Engineers, Business Analysts, Finance and Administration. We are a blend of quality people. We strive to maintain the open culture and work in close association. The way we work enables everyone to contribute while feeling contented sharing opinions and ideas to deliver the best software solutions.

Read More

Mazarin © 2023. All Rights Reserved.