Quotidien Shaarli

Tous les liens d'un jour sur une page.

April 23, 2024

Merge/squash commit in docker

Create a Dockerfile like this:

FROM your_image as initial
FROM your_image_base
COPY --from=initial / /

your_image_base should be something like 'alpine' - so the smallest image from which your image and its parents descend from.

Now build the image and check the history and size:

docker build -t your-image:2.0 .
docker image history your-image:2.0
docker image ls