When using legacy non-BuildKit image builds either via docker build
or docker image build
we notice some temporary containers being created and shown in docker stats
and was wondering if there was any way to customize the name of those temporary containers similar to how it’s done with docker create/run --name
I wouldn’t call it legacy build. When you are using Linux, I believe it is still not the default, although I didn’t have a full reinstall recently, but no, there is no way to name those containers. By the way buildkit creates containers too, you just can’t see them because those containers are not created by Docker, but runc. If you are wondering why those containers are created, I wrote about it on GitHub:
These are just temporary (as you already knew that) containers to build each layer.