`docker build` show output from `RUN`

  docker, dockerfile

I have this Dockerfile, where I run a command with RUN, and I want to see its output when running docker build:

FROM alpine:3.14
COPY . .
RUN echo "here are some numbers: $(seq 10)"

When I run docker build ., it doesn’t show the output of the above command:

[+] Building 2.8s (8/8) FINISHED                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                  0.0s
 => => transferring dockerfile: 36B                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                     0.0s
 => => transferring context: 2B                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14                                                                        1.2s
 => [internal] load build context                                                                                                     0.1s
 => => transferring context: 188.24kB                                                                                                 0.1s
 => CACHED [1/3] FROM docker.io/library/alpine:[email protected]:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0           0.0s
 => [2/3] COPY . .                                                                                                                    0.4s
 => [3/3] RUN echo "here are some numbers: $(seq 10)"                                                                                 0.2s
 => exporting to image                                                                                                                0.8s
 => => exporting layers                                                                                                               0.8s
 => => writing image sha256:7e0bf9ff04a7b4a3a53395d430ddd950500be9a53733cce22a1da1929cae1a0a                                          0.0s 
                                                                                                                                           
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them.

How do I see what the output is?

Docker version:

$ docker --version
Docker version 20.10.6, build 370c289

Source: Docker Questions

LEAVE A COMMENT