Skip to main content

Command Palette

Search for a command to run...

Understanding Docker Containers: A Beginner's Guide

Published
β€’2 min readβ€’View as Markdown
Understanding Docker Containers: A Beginner's Guide
M

πŸš€ DevOps & Cloud Engineer | ☁️ AWS | 🐳 Docker | ☸️ Kubernetes | βš™οΈ Jenkins | πŸ€– Ansible | πŸ› οΈ Terraform | πŸ”„ CI/CD | 🎯 ArgoCD | πŸ“ˆ Driving Automation and Cloud Scalibility

The first Question arises why there is a need of containers, When there were virtual machines already available

1)Virtualization is an advancement to physical servers whereas containers are advancement to virtualization.

2)Suppose a virtual machine is having 20 GB storage , 20 CPU and suppose a application running on it with capaicty occupies only 12 GB storage, 12 CPU.

Then 8GB ram, 8 CPUs of Virtual machine is not in use.This means virtual machines are not utilised to the fullest. Resources are getting waste on VM.

These unused values even increases when application is not having load or not running in full capacity.

3)Hence the concept of Containers came into picture.

Q2)what are Advantages of Using Containers?

1)Containers don't have full operating system.They have minimalistic Operating system(Base image) which consists of Application+App libraries+System dependencies.Hence Containers are lightWeight.

2)Because of this, containers are logically separated from each other and it becomes difficult for Hackers to hack the Containers.

3)The rest of the resources containers can use from Host operating system.

4)The size for a VM snapshot goes up to 2GB - 3GB whereas snapshot size for a Container only goes to 80MB - 150MB.

5)Suppose there are 3 containers running on a host VM.When C1 is not in full load and not using resources from Host OS ,it can allow other containers to use its resources from Host OS which is not possible in case of VMs because they have their own complete Operating system.

Q3)LifeCycle for a Docker Container:

1)Write instructions(docker commands) in a dockerfile.

2)Convert this dockerfile into docker image using docker build command.

3)Then create a Docker container from this image using docker run command.

Q4)Problems with Docker container?

1)Docker is mostly dependent on Docker Engine which is the heart of docker.

2)Docker engine is a single point of failure.This means if Docker engine goes down, Containers will stop working and application is not reachable to users.

3)When dockerfile gets converted into docker image , it forms a lot of layers which takes most of the disc space.

4)Hence Buildah come up as a solution to above issues.Its simple and works well with Scopio and podman and can even build docker images.