The glossary of docker says that
A Docker container consists of
A Docker image
Execution environment
A standard set of instructions
When I type docker images
, I see 324.2 MB in SIZE
column of mysql:5.6
.
When I type docker ps -s -a
, this command tells me that the size of the container, which is created by docker run mysql:5.6 -d
, is also 324.2 MB.
Does this mean that Execution environment
and A standard set of instructions
do not occupy any disk space?
or the disk space they use is less than 0.1 MB?
or docker ps -s -a
just lists the size of the container's image?
Because of the copy-on-write mechanism, the size of a container is... at first 0.
Meaning, you can launch 100 containers, then won't take 100 times the size of the image. They will share the filesystem proposed by the image.
Then any modification done during the life of the container will be written in a new layer, one per image.
See more at "Understand images, containers, and storage drivers":
When you create a new container, you add a new, thin, writable layer on top of the underlying stack. This layer is often called the “container layer”.
All changes made to the running container - such as writing new files, modifying existing files, and deleting files - are written to this thin writable container layer. The diagram below shows a container based on the Ubuntu 15.04 image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With