From fa5e8c3d5c2496303e2c2488a765b826e427caed Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Tue, 1 Nov 2016 18:48:25 +0800 Subject: [PATCH 1/2] Explain downloaded image and container sizes Signed-off-by: Yuqian Yang --- engine/tutorials/dockerimages.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/engine/tutorials/dockerimages.md b/engine/tutorials/dockerimages.md index 06713dfe47..e4b65dd4a1 100644 --- a/engine/tutorials/dockerimages.md +++ b/engine/tutorials/dockerimages.md @@ -568,6 +568,33 @@ Delete the `training/sinatra` image as you don't need it anymore. > **Note:** To remove an image from the host, please make sure > that there are no containers actively based on it. +## Check sizes of images and containers + +An image is +[stored in layers](../userguide/storagedriver/imagesandcontainers.md), +and shared with other images, the real disk usage depends on existing layers +on your host. A container is running on +[a writable layer](../userguide/storagedriver/imagesandcontainers.md#/container-and-layers) +on top of a readonly rootfs. + +You can figure the size of image layers with `docker history` command. + + $ docker history centos:centos7 + + IMAGE CREATED CREATED BY SIZE + 970633036444 6 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B + 6 weeks ago /bin/sh -c #(nop) LABEL name=CentOS Base Imag 0 B + 6 weeks ago /bin/sh -c #(nop) ADD file:44ef4e10b27d8c464a 196.7 MB + 10 weeks ago /bin/sh -c #(nop) MAINTAINER https://github.c 0 B + +Also, you can check the sizes of containers by performing `docker ps` command with `-s`. + + $ docker ps -s + + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE + cb7827c19ef7 docker-docs:is-11160-explain-image-container-size-prediction "hugo server --port=8" About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp evil_hodgkin 0 B (virtual 949.2 MB) + + # Next steps Until now you've seen how to build individual applications inside Docker From 2e5892e4a5b2a86d7084ab195bb965ef42a896dc Mon Sep 17 00:00:00 2001 From: John Mulhausen Date: Mon, 28 Nov 2016 14:52:55 -0800 Subject: [PATCH 2/2] Writerly changes --- engine/tutorials/dockerimages.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engine/tutorials/dockerimages.md b/engine/tutorials/dockerimages.md index e4b65dd4a1..ace16c5cbf 100644 --- a/engine/tutorials/dockerimages.md +++ b/engine/tutorials/dockerimages.md @@ -572,12 +572,14 @@ Delete the `training/sinatra` image as you don't need it anymore. An image is [stored in layers](../userguide/storagedriver/imagesandcontainers.md), -and shared with other images, the real disk usage depends on existing layers -on your host. A container is running on +shared with other images on the host, so the real disk usage depends on +how much layer overlap is happening between images on a host. + +A container runs on [a writable layer](../userguide/storagedriver/imagesandcontainers.md#/container-and-layers) on top of a readonly rootfs. -You can figure the size of image layers with `docker history` command. +Use `docker history` to see the size of image layers on your host: $ docker history centos:centos7 @@ -587,7 +589,7 @@ You can figure the size of image layers with `docker history` command. 6 weeks ago /bin/sh -c #(nop) ADD file:44ef4e10b27d8c464a 196.7 MB 10 weeks ago /bin/sh -c #(nop) MAINTAINER https://github.c 0 B -Also, you can check the sizes of containers by performing `docker ps` command with `-s`. +Check the size of containers with `docker ps -s`: $ docker ps -s