Docker builds in CircleCI: go faster, and support newer Linux versions
If you’re using CircleCI to build your Docker images, you might find yourself using an old version of Docker without realizing it.
That means:
- Slower builds.
- Lack of support for newer Linux distributions.
Let’s see why, and how to fix it.
BuildKit makes Docker builds faster
Newer versions of Docker add support for BuildKit, a new build backend that among other features (build secrets, and local caching which can speed up builds during development) also can make your production builds faster.
In particular, if you’re using multi-stage builds it will try to build the different stages in parallel.
Consider the following multi-stage Dockerfile
:
FROM ubuntu:20.04 AS build
RUN apt-get install -y