Actual Size a Docker Container uses in a OS Filesystem

When we execute command docker images, it lists the images and it’s sizes. Say one image has size 1GB, and let’s say, I am creating 2 docker containers using this image. So how much disc space the whole setup uses now?
1GB + 2 x 1GB = 3GB?
Or is it like the containers just refers to the image in a read only manner like we deploy a war in an application server? And it just adds the additional space required for temporary files?
I need this information to get an idea to progress with my sizing of a Linux box.
If the forum/mode of question is not proper, kindly give pointers. I will correct it.
Regards
Ashish

The containers just require their additional temporary space on top of the image; so the setup you require should still only require 1 GB.

There’s also sharing between Docker images. Say you have a 0.5 GB Java/Tomcat base image, and you build two images on top of it that add different 0.5 GB .war files. The base image is shared, so these images together require 1.5 GB total.

1 Like

Thanks David. That explains what I had thought as a weird behavior. It was not weird after all, I was just misinformed. :wink: