OSX Docker 构建:如何查看完整的构建输出? (--progress=plain 不是解决方案!)
OSX Docker Build: How can I see the full build output? (--progress=plain not the solution!)
我刚从工作中得到一台 MacBook,我正在用它来构建 docker 图像。通常,docker 构建会显示完整日志(即 ls -la
显示 cwd)。这至少是我在 linux 机器上的习惯。
但是在 macbook 上,它只显示一个简短的概述:(实际控制台输出)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 40B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:stretch-slim 1.1s
=> [internal] load build context 0.0s
=> => transferring context: 58B 0.0s
=> [1/16] FROM docker.io/library/debian:stretch-slim@sha256:eb436e834ba416c45359aa0709febef17fdea65ab6a8f4db12016aa2fa63be0c 0.0s
=> CACHED [2/16] RUN apt-get update && apt-get upgrade -y 0.0s
=> CACHED [3/16] RUN apt-get install wget -y 0.0s
=> CACHED [4/16] RUN wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz 0.0s
=> CACHED [5/16] RUN tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz 0.0s
=> CACHED [6/16] RUN mv mysql-5.7.22-linux-glibc2.12-x86_64 mysql-5.7.22 0.0s
=> CACHED [7/16] RUN ls -la 0.0s
=> CACHED [8/16] RUN mv mysql-5.7.22 /usr/local/ 0.0s
=> CACHED [9/16] RUN groupadd mysql 0.0s
=> CACHED [10/16] RUN useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql 0.0s
=> CACHED [11/16] RUN chown -R mysql /usr/local/mysql-5.7.22/ 0.0s
=> CACHED [12/16] RUN chgrp -R mysql /usr/local/mysql-5.7.22/ 0.0s
=> CACHED [13/16] COPY my.cnf /etc/ 0.0s
=> CACHED [14/16] COPY startup.sh . 0.0s
=> CACHED [15/16] RUN ls -la 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:d93a0842352d0980be6ba4b57fdd6cad18818b7527bedecfb706e416b7fb6062 0.0s
=> => naming to docker.io/library/customsql
第 7 步和第 15 步应该会显示结果,但这只是被省略了。 (我知道,它是缓存的结果,但是当我更改 Dockerfile 并重建层时它没有显示)。
设置--progress=plain
没有任何用处。事实上,它只是将颜色从紫色更改为白色 (HideThePainHarold.jpg)。
任何帮助将不胜感激。
我自己找到了答案:显然 Docker 在 osx 上构建会自动配置为使用 buildkit,这会掩盖很多默认的调试输出。
我从 JSON 配置中删除了它并且它有效。
只需在 shell 中设置 export DOCKER_BUILDKIT=0 ....
除了之外,如果您正在寻找永久设置。
要默认禁用 docker BuildKit,请将 /etc/docker/daemon.json
功能中的守护程序配置设置为 true 并重新启动守护程序:
{ "features": { "buildkit": false } }
我刚从工作中得到一台 MacBook,我正在用它来构建 docker 图像。通常,docker 构建会显示完整日志(即 ls -la
显示 cwd)。这至少是我在 linux 机器上的习惯。
但是在 macbook 上,它只显示一个简短的概述:(实际控制台输出)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 40B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:stretch-slim 1.1s
=> [internal] load build context 0.0s
=> => transferring context: 58B 0.0s
=> [1/16] FROM docker.io/library/debian:stretch-slim@sha256:eb436e834ba416c45359aa0709febef17fdea65ab6a8f4db12016aa2fa63be0c 0.0s
=> CACHED [2/16] RUN apt-get update && apt-get upgrade -y 0.0s
=> CACHED [3/16] RUN apt-get install wget -y 0.0s
=> CACHED [4/16] RUN wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz 0.0s
=> CACHED [5/16] RUN tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz 0.0s
=> CACHED [6/16] RUN mv mysql-5.7.22-linux-glibc2.12-x86_64 mysql-5.7.22 0.0s
=> CACHED [7/16] RUN ls -la 0.0s
=> CACHED [8/16] RUN mv mysql-5.7.22 /usr/local/ 0.0s
=> CACHED [9/16] RUN groupadd mysql 0.0s
=> CACHED [10/16] RUN useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql 0.0s
=> CACHED [11/16] RUN chown -R mysql /usr/local/mysql-5.7.22/ 0.0s
=> CACHED [12/16] RUN chgrp -R mysql /usr/local/mysql-5.7.22/ 0.0s
=> CACHED [13/16] COPY my.cnf /etc/ 0.0s
=> CACHED [14/16] COPY startup.sh . 0.0s
=> CACHED [15/16] RUN ls -la 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:d93a0842352d0980be6ba4b57fdd6cad18818b7527bedecfb706e416b7fb6062 0.0s
=> => naming to docker.io/library/customsql
第 7 步和第 15 步应该会显示结果,但这只是被省略了。 (我知道,它是缓存的结果,但是当我更改 Dockerfile 并重建层时它没有显示)。
设置--progress=plain
没有任何用处。事实上,它只是将颜色从紫色更改为白色 (HideThePainHarold.jpg)。
任何帮助将不胜感激。
我自己找到了答案:显然 Docker 在 osx 上构建会自动配置为使用 buildkit,这会掩盖很多默认的调试输出。
我从 JSON 配置中删除了它并且它有效。
只需在 shell 中设置 export DOCKER_BUILDKIT=0 ....
除了
要默认禁用 docker BuildKit,请将 /etc/docker/daemon.json
功能中的守护程序配置设置为 true 并重新启动守护程序:
{ "features": { "buildkit": false } }