CONTAINERS

What is an Image and a Container?

A Simple Explanation

Frank Ceballos

--

Photo by Denys Nevozhai on Unsplash

What is an Image?

An image is a snapshot of a Docker virtual machine at a specific point in time. Think about an image as a file system snapshot + starting command. To remove of ourselves from the abstract here is schematic representation of an image

For this particular image, we have 10 folders and the start up command is echo "Hello World" . Usually, the start-up command is the command that starts your application.

What is a Container?

A container is a process + a group of resources specifically assign to it. The process could either be Spotify, Word, your Python script, etc., and the group of resources could be 1GB of RAM, 2 CPU cores, 500 MB of hard drive storage, and 10% of a GPU.

When a container is being created the resources are first allocated, then the files from an image are copied into the memory of the container, and finally the start-up command is executed. The figure below shows a running container created with the image we previously discussed.

In the example shown above, the kernel takes the start up command and executes it. The kernel is aware of the resources the container can use so it governs it usage.

Find me at LinkedIn. Until next time! Take care and code everyday!

--

--