Docker build not showing any output from commands

Noname picture Noname · Nov 12, 2020 · Viewed 10.4k times · Source

Snippet from dockerfile:

FROM node:12.18.0
RUN echo "hello world"
RUN psql --version

When I run docker build . I don't see any output from these two commands even if they are not cached. The documentation says that docker build is verbose by default. Why am I not seeing the output from commands? I used to see them before.

The output while building: enter image description here The output I am seeing after building finishes: enter image description here

Dockerfile is created from node:12.18.0 which is based on Debian 9

Docker version 19.03.13, build 4484c46d9d.

Answer

BMitch picture BMitch · Nov 12, 2020

The output you are showing is from buildkit, which is a replacement for the classic build engine that docker ships with. You can adjust output from this with the --progress option:

  --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output
                            (default "auto")

Adding --progress=plain will show the output of the run commands that were no loaded from the cache.


If you don't want to use buildkit, you can revert to the older build engine by exporting DOCKER_BUILDKIT=0 in your shell, e.g.:

DOCKER_BUILDKIT=0 docker build ...

or

export DOCKER_BUILDKIT=0
docker build ...