Hey there! 👋
A new week and another deep-dive inside the container space. And this time I’m focused on answering the question that puzzled me forever - what’s INSIDE the Container Image? And as usual - we go with image first and the details below ;)
(click on image to expand)
If you were to just get started with containers, chances are that you’d be told to “run a container by pojnting it to image URL”. Here’s an example from Microsoft docs on how to start your first container:
# Pull the image first (i.e. download it to your local system)
docker pull mcr.microsoft.com/windows/nanoserver:ltsc2022
# Start your container and have fun :)
docker run -it mcr.microsoft.com/windows/nanoserver:ltsc2022
If you execute above two on your Windows system, chances are you’ll end up inside a container:
Now the real question is - what’s inside that image that we just unwrapped into a full-blown filesystem? Luckily, there are two ways to find out - Docker export and containerd’s image export.
Sadly, for reasons completely mysterious to me, former doesn’t really work:
So I had to resort to containerd’s image export:
Perfect! Now you untar it and you can explore the content inside:
We’ll discuss the actual content in the next article. What you need to know though is that the content follows the OCI Image specification (OCI stands for Open Container Initiative and it’s a standard that defines how container-related stuff should work; there’ll be another article about it as well!).
Lastly, I’d like to introduce you to a tool called dive
. It’s a free to use tool that can be used to explore the contents and some other attributes of the images:
dive.exe mcr.microsoft.com/windows/nanoserver:ltsc2022
Dive is an extremely powerful tool which is especially useful when you end up with multiple layers abd want to inspect if you can do some space-savings. But more about Layers and other details in the next article!
Until then, if you haven’t already, you might want to subscribe to this newsletter:
If you missed previous articles, here are the last three I published: