Dive into Docker

Before discussing about docker, we need to understand two important questions.
Why use Docker? What is Docker?
Let’s first focus on Why use Docker, so before diving into specifics, we will try to recap on how to deploy software to different environments requires significant effort both installation of various software and complex configuration required to run the application.

See below figure 1.0 shows how much time and money can be saved with the docker concept.


let’s see another typical example, when you are trying to install software, you will encounter error installing software.

This is what Docker is trying to fix. Docker wants to make it easy to install and run software in your PC/Laptop, remote server, in any Cloud environment.So Docker makes it really easy to install and run software without worrying about setup or dependencies, other benefits are

  • Build any app in any language using any stack (OS).
  • Dcokerized apps can run anywhere on anything.
  • No more “It works on my machine”.
  • No more dependency daemons so Developers and System admins unite.

What is Docker?

This question is lot more challenging to answer, docker has ecosystem of tools, see below figure.

Docker is a tool or platform that takes an application and everything that that application need to run and bundles it together into a small, shareable executable. That executable is called container.The executable container can run on any computer which has docker installed. Docker helps us package our application quickly and reach release cycle quickly, accelerating our DevOps Cycle.

Docker Key Concepts?
we need to understand concepts like images, containers and layers clear in your mind before you start running Docker commands.

First let’s understand what is an image and a container is, how a single image can create a multiple containers.

Images: it’s really a snapshot of filesystem layers and some metadata, also contains startup command to spun up a Docker container.

Image = File System Snapshot(Directories and Files) + Startup Command

Layers: A layer is a collection of changes to files.Images are created from a layered filesystem, which reduces the space used by Docker images on your host.

Sample todoapp’s file system layering in Docker.

Container: A container is a running process and subset of file system resources on your computer that are allocated to that process specifically.
Or
Container is a running instance of an image. you can have multiple containers running from the same image.

Here is what happens when taking an image into container, see fig below.

 

Linux Kernel isolate little section of hard drive just to make it available to this container. The file system snapshot in the image is taken and placed inside little segment of hard drive. Then start up command can be executed, in this case, running the asp.net web application. asp.net web site created and run inside the running process, that process is isolated to this particular resources inside the container.that’s the relation ship between image and container. Image is taken in to running container.

Key Docker Commands:

Docker’s central function is to build, ship, and run software in any location that has Docker. To the end user, Docker is command-line program that they run. Docker subcommnads you’ll use on your host are listed here.

Command                              Purpose
—————————————————————————————
docker build                          Build a Docker image
docker run                             Run a Docker image as a container
docker commit                     Commit a Docker container as an image
docker tag                              Tag a Docker image
—————————————————————————————-

How Docker Running on Your Computer?
see below figure.

When you install Docker for Windows or Docker for MacOS, you installed a Linux Kernel virtual machine.Technically a Linux Virtual Machine is running on your computer, inside this Linux Virtual Machine all these containers were created.Linux Kernel is going to be hosting running process inside the container.

That’s it for about docker. have a great day…

local_offerevent_note March 31, 2019

account_box srinivasaraju nadimpalli


local_offer