Trumpeting elephant

Upgrade PostgreSQL in Docker

Upgrading postgresql can’t be done in-place, so here’s a scripted version to help you do so.

2023-08-17 · 2 min · 382 words

Chowning files can take a lot of space in a Docker image

Today I learned that recursively changing the owner of a directory tree in a Dockerfile can result in some serious increase in image size. 🚛 The issue You may remember how in a previous post we used a small example to discuss layers and final image size. Well, here’s our example again, slightly modified. # Dockerfile FROM ubuntu WORKDIR /app RUN fallocate -l 100M example RUN chown 33:33 example Given that the base image weighs ~75MB, we could expect the final image to weigh ~175MB (~75 from the base image + ~100 from the big file we generated)....

2021-03-02 · 4 min · 643 words

Lighten your Python image with Docker multi-stage builds

In previous posts we talked about poetry and Docker images layers and I promised I would write about Docker multi-stage builds, so here we go! Note I will explain the basics of Docker multi-stage builds required to understand the post, but I won’t repeat the documentation (see further reading). ⚙️ Multi-stage builds Basically a multi-stage build allows you to sequentially use multiple images in one Dockerfile and pass data between them....

2021-01-02 · 6 min · 1135 words

Docker images layers and cache

In this post, we’ll walk through Docker image layers and the caching around them from the point of view of a Docker user. I’ll assume you’re already familiar with Dockerfiles and Docker concepts in general. ✌️ The two axioms of Docker layers There are two key concepts to understand, from which everything else is deduced. Let’s call them our axioms. Axiom 1 Every instruction in a Dockerfile results in a layer1....

2020-12-28 · 10 min · 1949 words