My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Understanding docker Containers and images

Understanding docker Containers and images

Prabu Subra's photo
Prabu Subra
·Nov 24, 2018

Containers — A technology to run one or more than one process on an independent and isolated environment.

What are process here?

Execution of programs(set of instructions). It could be applications, databases, message queues, etc…

What are resources needed to execute a process standalone?

Memory
CPU
I/O devices
Files Systems

In our day to day life, we use the containers without knowing. For example Parallel Space/Secondary space and Dual apps features in Android mobiles are using Linux Container technology.

In Linux kernel, we have options to create more than one parallel space and run a process inside of it, like jail, These are called as containers.

Linux kernel features behind containers:-

Using linux Kernel Namespace, Cgroup, chroot and UnionFS features host Linux kernel can split host resources.

Namespaces → This feature isolates below terms from host and other containers.

Mount — isolate filesystem mount points.
UTS — isolate hostname and domain name.
IPC — isolate interprocess communication (IPC) resources.
PID — isolate the PID number space.
Network — isolate network interfaces.
User — isolate UID/GID number spaces.

Cgroups → limits resources like CPU, memory, network...

Chroot → change the root directory for specified process and its child processes.

UnionFS → layered File system. it help for effective reuse of docker image.

If containers share host operating systems, then

Why do we have operating system images(Container OS) on docker registries?

Containers are running on Host kernel, but OS utilities and libraries are not available, because of isolation(Namespace). Containers cannot access softwares installed on Host OS. so we have to configure required software for each docker container as docker image in Dockerfile.

What is actually is operating systems image(Container OS)?

These images are not full fledged Operating systems, just a bunch of utilities/libraries.

Therefore, To run a container, we just need to load few utilities not full operating systems.

Docker Container CLIs:-

dockercontainerclis.png

Images — A blueprint or template, from which one or more than one containers can be created.

dockerfile.png Most of the images are build based on Scratch image. It is like super parent image. Scratch doesn’t have any utility, it is empty image with zero size. image size is depends on its utilities, libraries and apps.

Docker image CLIs:-

dockerimageclis.png Dockerfile:-

Docker image is created from Dockerfile. it has a set of vocabularies to execute processes with its dependencies independently.

Dockerfile:-

dockerfileclis.png Eventually, using container technology software can be created/changed, packed, tested and shipped quicker with less hurdles than traditional ways. It simplifies software business. programmable Platform (PaaS) accelerate software development and deployment(SaaS).

Thanks for reading… This is my understanding after using docker for few months. Feel free to comment your suggestions !!!