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: