What is a "build container"

Hello all,

reading through the Dockerfile documentation, the section relating to the RUN instruction mentions “build containers”…

This mount type allows binding files or directories to the build container. A bind mount is read-only by default.

In this context, what is a build container?

It’s not explained in the Dockerfile documentation but from the language surrounding it, I get the impression it’s not the same as a normal container.

Any help is appreciated!

I wrote this tutorial for an older version of Docker, but the concept of build containers is the same. Except that buildkit creates these containers differently and you don’t see them using docker commands.

In short:

A build container is a container that is created by every instruction in the Dockerfile (at least it was the case). When you use the RUN instruction, it creates a container, runs the command, commits the container to an image layer.

3 Likes