Why is a new docker image the same size of the original one from which the commit was made?

Viewed 25

I downloaded a Docker image and made some changes inside a container based on it. Then I commited those changes to create a new image that I would actually like to use.

docker images says that these images have about the same size. So, it seemed to me that Docker copied everything it needs to the new image.

Yet I can't remove the old image which I no longer need. It seems like I'm getting the worst of both worlds: neither is space conserved by a parenting relationship, nor can I delete the unwanted files.

What gives? Am I interpreting docker images output wrong (maybe it's not reporting the actual on-disk size)?

1 Answers

you may remove the first image with a force,

docker image rm -f $IMAGE_ID

As for the same size, it depends mainly on your changes, you can check if they match exactly on a byte level with:

docker image inspect IMAGE_NAME:$TAG --format='{{.Size}}'
Related