Containers in Docker

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

Docker Containers

Docker: Implementation of a container which is portable using a concept of image

Container: Group of processes contained in an isolated environment. The isolation provided by concepts like groups and namespaces.

Containers in Docker

All of the computing is based upon running some “function” on a set of “physical” resources, like processor, memory, disk, network, etc., to accomplish a task, whether a simple math calculation, like 1+1, or a complex application spanning multiple machines, like Exchange. Over time, as the physical resources became more and more powerful, often the applications did not utilize even a fraction of the resources provided by the physical machine. Thus “virtual” resources were created to simulate underlying physical hardware, enabling multiple applications to run concurrently – each utilizing fractions of the physical resources of the same physical machine.

If you want to enrich your career and become a professional in Docker, then visit Tekslate - a global online training platform: "Docker Training"   This course will help you to achieve excellence in this domain.

Capture 35

Docker image is a Layer in the system.

-Containers are two layers

-Init layer

-Content layer

Data structure which resides in memory and is persisted in SQLite store

Building a container

A docker container is basically a process or a set of processes running in isolation with a predefined provisioned file system.

A container is a collection of processes that have access to the files in the image.

docker pull image_name:tag

The pull command will download the image and all its parents needed to create the containers with that image. The tag parameter is usually used as the part of the name, but if your container evolves, or includes different versions of the software used, it’s nice to tag them without changing the base image name.

docker create --name container_name image_name:tag

The create command is used to instantiate the container from the image

To start and stop the container, naturally, you’ll use the docker start container_name and docker stop container_name commands respectively.

When there’s a stop command, there’s a kill command too, to terminate the process less graciously.

Create the container and run it, which is really useful for the various one-liners.

Create a docker file in the directory that describes the image and then run:

docker commit -m "commit message" -a "author" container_id username/imagename:tag

To run a command inside the container namespace you run the following docker command:

docker exec -ti container_name "command.sh"

The container is running, you can do that multiple times: install necessary components, copy files around, etc. In general, you don’t want to build your project into the container, you just map the file system on the host to a directory inside the docker container. Then you don’t have to worry about changing the build process for your project and you can run it in the same fashion on your host or in the docker container. But if you build the project in the container, map or commit your local Maven repository, npm modules, or that of any dependency management tool you use: if will avoid downloading the internet again and again and make building the project so much faster.

For an in-depth understanding of Docker click on:

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox