Why are container's size and image's size equivalent?
The glossary of docker says that
A Docker container consists of
docker: 'stack' is not a docker command How to forward hostname based request to a specific docker container docker-compose up for only certain containers Docker missing layer IDs in output Get docker swarm manager node from jenkins job Git push hang in there
A Docker image
A standard set of instructions
When I type
docker images, I see 324.2 MB in
SIZE column of
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?
docker ps -s -a just lists the size of the container’s image?
One Solution collect form web for “Why are container's size and image's size equivalent?”
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.