Docker Community Forums

Share and learn in the Docker community.

Build a docker image with a specific size

How build a docker image from a dockerfile with a specific size ?

Not possible to specify a specific size for a docker image you are building.

But you should try and keep your docker images as small a possible.

-Try and use alpine docker images as your base docker image in your Dockerfiles.
-Use a .dockerignore https://docs.docker.com/engine/reference/builder/#dockerignore-file
-Use multi-stage builds if possbile.
-Cleanup stuff not needed in your docker image.

1 Like