docker-compose

How to see image build hashes on docker-composer?


on docker build i get intermediate image hashes, e.g.

...
Step 7/25 : WORKDIR /app
 ---> Running in 819fa44fe4d0
 ---> Removed intermediate container 819fa44fe4d0
 ---> 7a3e08ea465f
Step 8/25 : COPY --from=deps /app/node_modules ./node_modules
...

and if something fails, i can just start image 7a3e08ea465f and investigate... but building with docker-composer hides those hashes:

...
[+] Building 1.4s (12/17)                                                                                                                               docker:default
 => [fe internal] load build definition from Dockerfile                                                                                                           0.0s
 => => transferring dockerfile: 2.32kB                                                                                                                            0.0s
 => [fe internal] load metadata for docker.io/library/node:alpine                                                                                                 0.8s
 => [fe internal] load .dockerignore                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                   0.0s
 => [fe base 1/1] FROM docker.io/library/node:alpine@sha256:22b3c1a1171c798c0429f36272922dbb356bbab8a6d11b3b095a143d3321262a                                      0.0s
 => [fe internal] load build context                                                                                                                              0.4s
 => => transferring context: 19.44MB                                                                                                                              0.4s
 => CACHED [fe builder 1/4] WORKDIR /app                                                                                                                          0.0s
...

How can I restore that functionality on composer?


Solution

  • It seems that you are using legacy builder of docker (not BuildKit), so adding --progress plain will add ID of intermediate images to the output:

    docker compose build --progress plain
    

    BuildKit will not output such information, then you will have to set DOCKER_BUILDKIT to 0 to force use of legacy builder:

    DOCKER_BUILDKIT=0 docker compose build --progress plain