Reputation: 3539
Could someone explain or link an article that explain about Docker 'sizes' ?
For example - I pulled some Windows based containers:
docker system df --verbose
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
mcr.microsoft.com/windows/servercore 1909-amd64 8116ea20e860 3 weeks ago 5.509GB 5.509GB 0B 0
mcr.microsoft.com/dotnet/framework/aspnet 4.8-windowsservercore-1909 eff771fe260f 3 weeks ago 7.523GB 7.523GB 0B 0
mcr.microsoft.com/windows/servercore ltsc2019 31902e4b25a6 4 weeks ago 5.212GB 0B 5.212GB 0
mcr.microsoft.com/powershell lts-windowsservercore-2004 7c3eedbd9958 6 weeks ago 4.84GB 0B 4.84GB 0
mcr.microsoft.com/dotnet/framework/sdk 4.8 27c31113cb5e 3 months ago 8.667GB 0B 8.667GB 0
microsoft/mssql-server-windows-developer 2017-GA 454b8faa6c43 3 years ago 11.55GB 0B 11.55GB 0
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
db7868c7480c mcr.microsoft.com/powershell "cmd" 0 0B 4 seconds ago Exited (0) 1 second ago happy_agnesi
Local Volumes space usage:
VOLUME NAME LINKS SIZE
721e8ed501b31c35f3d847b09189ce21a1c33c32b0daff48fa2a17e57c92afda 0 0B
73f678eec23d645575b96df63d48c9b3c7b3c379bd11f01d12d6fc0a7180fa2d 0 0B
e1e165e9776dda6afb73ba8af79e337f6ef19268935fdf485aead0942bb5934d 0 0B
3210cffd7ef3a592487b69695338448cb9aa31917c2dc2c25e628e866a71ba6a 0 0B
Build cache usage: 0B
CACHE ID CACHE TYPE SIZE CREATED LAST USED USAGE SHARED
So as I understand from data above for Docker image mcr.microsoft.com/windows/servercore
for example:
5.509GB
on my physical hard-disk ?docker run -d .....
does this size stacked up ? So 2 running containers of above image will take around 5.509 Gb + 5.509 Gb = 11.018 Gb
on my physical hard-disk ?mcr.microsoft.com/dotnet/framework/aspnet
based on layers of mcr.microsoft.com/windows/servercore
image - so does it have any impact on docker push
command (to private repo) ? Any impact on docker pull
command ?running
state) - is there any place/command where I could see this size ? Could I limit this size on Windows images ?memory
of running container: it not shared between containers (?) so let say that running 100 memory hungry containers will effectively eat all physical memory on my computer and then what ? Running new container will be denied ? Everything gonna freeze ? Any tools to prevent this ?Upvotes: 3
Views: 1033
Reputation: 5514
I had the same question and the answer I wanted is this:
• SHARED SIZE is the amount of space that an image shares with another one (i.e. their common data)
• UNIQUE SIZE is the amount of space that is only used by a given image
• SIZE is the virtual size of the image, it is the sum of SHARED SIZE and UNIQUE SIZE
From: https://docs.docker.com/engine/reference/commandline/system_df/
Upvotes: 0
Reputation: 729
# You already have an Image that consists of these layers
3333
2222
1111
# You pull an image that consists of these layers:
AAAAA <-- You only need to pull (and need additional space) for this layer
22222
11111
If you remove the first image only the layer 3333 will be removed, but the other 2 layers are still used by a different image and can't be removed.
/opt/helloworld.txt
the container doesn't need the space for the debian image because all layers are shared space. You only need the space for the file /opt/helloworld.txt
mcr.microsoft.com/windows/servercore
You only need space for your own additional layers./var/lib/docker/containers/<container>/<container>-json.log
(your docker path might vary). And yes it takes the space on the harddrive. Your running container has an entry in /var/lib/docker/containers/overlay2/
with all the changed on the filesystem of the container compared to your image (e.g. if you write a log that didn't exist before it will be located there). If the directory only contains the logfile(s) you can create a volume for the directory and use logrotate from the host. Otherwise you're stuck with it and the space it eats up.Upvotes: 1