Docker构建彩色消息不可读

我在 Windows 10 上使用“docker build”来构建 asp net core web 应用程序映像。但是,自上次更新以来,消息的颜色变得不可读。在互联网上搜索没有提供任何答案。
关于如何解决这个问题的任何想法?

回答

使用 docker,您可以将--help选项传递给命令以查看使用情况。例如:

$ docker build --help

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
  -o, --output stringArray      Output destination (format: type=local,dest=path)
      --platform string         Set platform if server is multi-platform capable
      --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --secret stringArray      Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret
      --squash                  Squash newly built layers into a single new layer
      --ssh stringArray         SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|<id>[=<socket>|<key>[,<key>]])                                                                                                                     
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.

要关闭彩色输出,您可以设置--progress plain删除彩色格式化文本和其他 tty 功能,例如更新每个构建步骤的时间。

或者,您可能只想更改终端的颜色。黑色和白色都很好用。但是蓝色背景会与蓝色文本发生冲突。


另一种选择是禁用 buildkit 并恢复到经典构建引擎。这可以通过环境变量来完成:

export DOCKER_BUILDKIT=0

或配置默认值/etc/docker/daemon.json

{
  "features": {"buildkit": false }
}

然而,经典构建器将不支持添加到 buildkit 的功能,并且不太可能看到更多的发展。


以上是Docker构建彩色消息不可读的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>