Why are container's size and image's size equivalent?
The glossary of docker says that
A Docker container consists of
How to set hosts in docker for mac Mapping an existing local neo4j database to a neo4j docker container Using bower inside a docker container with a private repo dependency Requests to docker-machine created boot2docker host docker-compose copies files as folder Subscribing to Docker Events
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.