Categories: Dockers

Deep Dive – Docker Images & Containers Internals

Following are some of the cool links which can help you get started with knowing Docker internals for images and containers:

Following diagram represents the concepts on docker image and container.

Figure 1. Docker Image vs Containers (credit: Docker Internal)

Pay attention to some of the following in above diagram:

  • Docker images comprise of readable layers stacked on top of each other. These layers are shared across different containers. Each of these layers are also termed as the “image”. Thus, a docker image of any software package can comprise of multiple images (layers) such as bootfs, rootfs etc., stacked on top of each other. Following are some of the key images which form part of any docker image:
    • bootfs
    • rootfs (base image resembling linux/unix/windows filesystem)
    • Other images which are added on top of the rootfs (base image)

    Following image shows up the layers in Union FileSystem (Docker image filesystem) which are stacked on top of each other in a Docker image. Base image represents the rootfs. All the layers except container are read-only.

    Figure 2. Docker Image Layers

     

  • Docker containers represent a read-write filesystem which is mounted by docker on top of images’ layers. This is the layer where docker container processes will read/write the data. Any files of underlying layers when changed will be copied into the read-write layer of the container. Any new files will also be read into the read-write layer. When the container is removed, this read-write filesystem layer is removed.  It implies that multiple containers can share the same with unique writable layers as shown in figure 1.  Following diagram represents the docker image having images of Apache and emacs stacked over each other, and, a writable layer for container.

    Figure 3. Docker images and containers (image credit: Union file system)

    Pay attention to some of the following:

    • bootfs (resembles unix/linux/windows boot filesystem)
    • rootfs (base image – Ubuntu) stacked on top of bootfs (boot filesystem)
    • emacs and apache added/stacked as an image
    • Container read-write filesystem stacked on top of images


Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Share
Published by
Ajitesh Kumar
Tags: docker

Recent Posts

Retrieval Augmented Generation (RAG) & LLM: Examples

Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…

1 week ago

How to Setup MEAN App with LangChain.js

Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…

2 weeks ago

Build AI Chatbots for SAAS Using LLMs, RAG, Multi-Agent Frameworks

Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…

2 weeks ago

Creating a RAG Application Using LangGraph: Example Code

Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…

3 weeks ago

Building a RAG Application with LangChain: Example Code

The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…

3 weeks ago

Building an OpenAI Chatbot with LangChain

Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…

3 weeks ago