I recently heard about Buildkit and have been trying to use it with Docker.
I'm using
DOCKER_BUILDKIT=1 docker build . -t experimental
to build my Dockerfile.
My Dockerfile
doesn't build properly because of some missing dependant packages.
What I want to do is to attach to the last working intermediate container and fix the problem with say, apt
tools.
When building without Buildkit, this would have been possible with the hash values of intermediate containers from the terminal output.
However, the output from Buildkit is not providing me such values. So, is there any way for me to access them?
Thanks in advance.
I think it is not possible at the moment see buildkit/issue#1472.
But BuildKit still caches all layers so you could use a work around.
Inspecting the image before the failing RUN
command, comment out the failing and all subsequent RUN
commands. Rerun docker build
and then do docker run
to inspect the image.
Inspecting the image after the failing RUN
command, add || true
at the end of your RUN
command to force the command to succeed. Rerun docker build
and then do docker run
to inspect the image.