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

    • 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?

  • Using mysql image from docker
  • How to list all tags for a Docker image on a remote registry?
  • Use gcloud with docker
  • Docker Compose Containers with specific hostpath on nginx
  • Docker - exporting the DB file
  • Docker swarm use local service instance
  • 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.

    https://docs.docker.com/engine/userguide/storagedriver/images/container-layers.jpg

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.