Docker构建不显示命令的任何输出 [英] Docker build not showing any output from commands

查看:77
本文介绍了Docker构建不显示命令的任何输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

dockerfile中的代码段

Snippet from dockerfile:

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

当我运行 docker build.时,即使没有缓存这两个命令,我也看不到任何输出.该文档说 docker build 在默认情况下是冗长的.为什么我看不到命令​​的输出?我以前看过他们.

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: The output I am seeing after building finishes:

Dockerfile是从基于Debian 9的node:12.18.0创建的

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

Docker版本19.03.13,内部版本4484c46d9d.

Docker version 19.03.13, build 4484c46d9d.

推荐答案

您显示的输出来自buildkit,它是docker附带的经典构建引擎的替代品.您可以使用-progress 选项调整输出:

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")

添加-progress = plain 将显示未从缓存加载的运行命令的输出.

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

如果您不想使用buildkit,则可以通过在外壳程序中导出 DOCKER_BUILDKIT = 0 来恢复到较早的构建引擎,例如:

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 ...

export DOCKER_BUILDKIT=0
docker build ...

这篇关于Docker构建不显示命令的任何输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆