EMAIL SUPPORT

dclessons@dclessons.com

LOCATION

US

Docker Image Deep-Dive

Docker Image Deep-Dive

Docker Image

Here we will see how to build and image and containerize this image to run any application.

In this Process the first step is to pull image from image registry and most popular image registry is docker hub. With Docker pull command, image can be downloaded locally at Docker host and from there we can containerize it.

Images in Docker are made up from multiple layers which are stacked on top of each other to represent a single object. This layers of image is generally cut-down OS and all of the files and dependencies required to run an applications. Images are said to be build-time construct and containers are said to be run-time construct.

Images contains all small size OS, all applications files required to run the app/service due to which container are very fast and light weight. Container running on Docker host share access to Host Kernel.

Example: Alpine Linux Docker image is only 4MB size whereas official Ubuntu Docker image is approx. 110 MB size because they have stripped all or most non-essential parts.

Microsoft/dotnet: latest image is about 1.7 GB whereas Windows Server 2016 Nano server image (Microsoft/nanoserver: latest) is somewhere around 1 GB.

How to pull Images

In start, Docker Host has no images in its local repository. In a Linux based lost Host. Local image is stored on : /var/lib/docker/

On windows Docker host, Local images are stored in C:\ProgramData\docker\windowsfiler.

To verify, if Docker host has any image in its local repository, use below command

Now to pull images on to Docker host is called image pulling. Below example will show you how to pull image.

Here we see that Ubuntu: latest images has been pulled from Docker Hub and stored locally.

Now there is also option to pull the image and name it, below command will show us how to run the container by pulling images, name it with following command:

$ docker run – name = dclessonsubuntucontainer Ubuntu

It will show that image has been built with four different sub layers, which further show you tags, image ID etc.

$ docker ps –a

This command will show you, container in exited state, as soon as container run the command “\bin\bash”, but it is now not available or provided so it exit out.

Now if you want to run a container with bin\bash command use following command in below figure.

Here bin\bash command will spin up the container, as it will use bin\bash to run container and now ps will show container is running with bin\bash shell UP and running.

Another example of pulling images:

Images Registries

Docker images are stored in images registries and docker also provides one global registry names as docker hub ( https://hub.docker.com) . There are also some 3rd party registry and secure on-prim registries. An image registry can contains multiple images repositories which in turn contain multiple images. Below figure shows image registry which further contain 3 repository and contains one or more images.



There are official and unofficial repositories available. Docker Hub is said to contain both official and unofficial repositories.

Official Repo contain images that have been verified by Docker, Inc. which is up to date, high quality code, secure and well documented.

Unofficial repo has images but cannot be safe, secure, may not have well documented, and built along with best practices.


Comment

    You are will be the first.

LEAVE A COMMENT

Please login here to comment.