From 5dc44f03f0613d5b8062b83157e6f2be9bcf1df2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 18 Aug 2023 21:27:56 +0200 Subject: [PATCH] classic builder: align "removing intermediate container" output This is something that stood out to me: removing the intermediate container is part of a build step, but unlike the other output from the build, wasn't indented (and prefixed with `--->`) to be shown as part of the build. This patch adds the `--->` prefix, to make it clearer what step the removal was part of. While at it, I also updated the message itself: this output is printed _after_ the intermediate container has been removed, so we may as well make it match reality, so I changed "removing" to "removed". Before: echo -e 'FROM busybox\nRUN echo hello > /dev/null\nRUN echo world > /dev/null\n' | DOCKER_BUILDKIT=0 docker build --no-cache - Sending build context to Docker daemon 2.048kB Step 1/3 : FROM busybox ---> a416a98b71e2 Step 2/3 : RUN echo hello > /dev/null ---> Running in a1a65b9365ac Removing intermediate container a1a65b9365ac ---> 8c6b57ebebdd Step 3/3 : RUN echo world > /dev/null ---> Running in 9fa977b763a5 Removing intermediate container 9fa977b763a5 ---> 795c1f2fc7b9 Successfully built 795c1f2fc7b9 After: echo -e 'FROM busybox\nRUN echo hello > /dev/null\nRUN echo world > /dev/null\n' | DOCKER_BUILDKIT=0 docker build --no-cache - Sending build context to Docker daemon 2.048kB Step 1/3 : FROM busybox ---> fc9db2894f4e Step 2/3 : RUN echo hello > /dev/null ---> Running in 38d7c34c2178 ---> Removed intermediate container 38d7c34c2178 ---> 7c0dbc45111d Step 3/3 : RUN echo world > /dev/null ---> Running in 629620285d4c ---> Removed intermediate container 629620285d4c ---> b92f70f2e57d Successfully built b92f70f2e57d Signed-off-by: Sebastiaan van Stijn --- builder/dockerfile/containerbackend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/dockerfile/containerbackend.go b/builder/dockerfile/containerbackend.go index 5fcac4467b..3527d3e914 100644 --- a/builder/dockerfile/containerbackend.go +++ b/builder/dockerfile/containerbackend.go @@ -141,6 +141,6 @@ func (c *containerManager) RemoveAll(stdout io.Writer) { return } delete(c.tmpContainers, containerID) - fmt.Fprintf(stdout, "Removing intermediate container %s\n", stringid.TruncateID(containerID)) + _, _ = fmt.Fprintf(stdout, " ---> Removed intermediate container %s\n", stringid.TruncateID(containerID)) } }