🐳 Docker Crash Course: Unleashing the Power of Containerization 🚢

Geeky much!
INFRA_READ
Published in
3 min readDec 3, 2023

IT folks were tired of running a single application on an entire server. Another option was watching VMs devour precious resources. It’s time to dive into the world of Docker and how it revolutionizes the development and deployment process!

Understanding the Problem:

🔄 Single App per Server vs. Docker Containers: Running a single app on a server is so last decade! Docker containers, provide a lightweight, efficient way to package, ship, and run applications with all their dependencies.

🚀 VMs Resource Challenge: Traditional VMs can be resource hogs, consuming more than their fair share. Docker containers are here to save the day, offering isolated environments without the hefty resource overhead.

Containerization is operating system-level virtualization or application-level virtualization over multiple network resources so that software applications can run in isolated user spaces called containers in any cloud or non-cloud environment, regardless of type or vendor. It is a software deployment process that bundles an application’s code with all the files and libraries it needs to run on any infrastructure. PLUG and PLAY.

An isolated environment in Docker is a container isolated from other containers and the host machine. This isolation is achieved by using Docker’s features such as namespaces and cgroups. Namespaces allow you to isolate a container’s process space, network stack, and other resources. Cgroups allow you to limit a container's resources, such as CPU, memory, and disk space.

Isolated environments in Docker are useful for a variety of purposes, such as:

  • Development: Isolated environments can be used to create development environments that are independent of the host machine. This can be useful for developing applications that need to be run on a specific platform or that require specific software to be installed.
  • Testing: Isolated environments can be used to create test environments that are independent of the production environment. This can help to ensure that tests are not affected by changes to the production environment.
  • Deployment: Isolated environments can be used to deploy applications to production. This can help to ensure that applications are isolated from other applications and the host machine.

Once you have created an isolated environment, you can start it with the docker start command. You can then access the container using the docker exec command.

Key Docker Concepts:

🔗 Dependency Management: Bid farewell to dependency nightmares! Docker simplifies dependency management by encapsulating everything your app needs within a container.

📦 Containers and Images: Images serve as blueprints, while containers are the active instances executing your applications.

🛠️ Dockerfile: A Dockerfile is a text document that contains instructions for building an image. The instructions are based on a set of simple commands.

A Dockerfile is the source code for a Docker image. It can be used to:

  • Build an image: Using the docker build command
  • Run an image as a container: Using the docker run command

🐳 DockerHub: Docker Hub is a cloud-based registry service that allows developers to find, use, and share container images. It is a popular choice for hosting Docker images because it is free and easy to use. Save time and effort by leveraging pre-built images on DockerHub created by the community.

Docker commands cheat sheet

Deep Dive into Docker Internals:

🔧 Container Runtimes: A container runtime, also known as a container engine, is a software component that can run containers on a host operating system. Example: runc and containerd that power Docker's magic.

🤖 Docker Daemon and API: The heroes managing your containers. They facilitate communication between the Docker CLI and the engine.

The Docker daemon is a background process that manages Docker images, containers, networks, and storage volumes. It constantly listens to Docker API requests and processes them.

The Docker API is a REST API that allows other programs to interact with the Docker daemon. Whenever you use a “docker” command, the client uses the API to tell the Docker daemon what it should do.

Hands-On Practice:

👩‍💻 Creating Dockerfiles: Follow step-by-step guides for creating Dockerfiles. Build custom images tailored to your application’s needs.

Share the word and follow for more upcoming posts. Thanks!

--

--