Khader Syed

Reducing the size of a docker image

Sun Oct 18 2015

#docker#image#size

I’ve been building a docker image for Heketi and noticed that the image size was more than 3 times the size of a base Centos 7 image. Searching on google, I came across this page on optimizing docker images. Now, I understand why the Dockerfiles spread across github have multi-line RUN commands.

My docker image started with a size of around 698.2 MB. Now it’s just 198.5MB.

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
heketi/heketi       centos7             eda2e47811c6        15 seconds ago      198.5 MB
docker.io/centos    latest              ce20c473cd8a        5 days ago          172.3 MB

You can take a look at the Dockerfile I created.