【问题标题】:docker buildx fails to show result in image listdocker buildx 无法在图像列表中显示结果
【发布时间】:2022-12-10 15:40:34
【问题描述】:

以下命令不显示输出ubuntu1图像:

docker buildx build -f 1.dockerfile -t ubuntu1 .
docker image ls | grep ubuntu1
# no output

1.码头文件:

FROM ubuntu:latest
RUN echo "my ubuntu"

另外,我不能在其他 docker 文件中使用 FROM 语句中的图像(两个构建都在我的本地 Windows 机器上):

2.码头文件:

FROM ubuntu1
RUN echo "my ubuntu 2"
docker buildx build -f 2.dockerfile -t ubuntu2 .

#error:
WARNING: No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 1.8s (4/4) FINISHED
 => [internal] load build definition from 2.dockerfile                                                                                                                                                        0.0s
 => => transferring dockerfile: 84B                                                                                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => ERROR [internal] load metadata for docker.io/library/ubuntu1:latest                                                                                                                                       1.8s
 => [auth] library/ubuntu1:pull token for registry-1.docker.io                                                                                                                                                0.0s
------
 > [internal] load metadata for docker.io/library/ubuntu1:latest:
------
2.dockerfile:1
--------------------
   1 | >>> FROM ubuntu1:latest
   2 |     RUN echo "my ubuntu 2"
   3 |
--------------------
error: failed to solve: ubuntu1:latest: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed (did you mean ubuntu:latest?)

知道发生了什么事吗?我如何查看 buildx 准备的内容并在另一个 dockerfile 中引用一个图像?

【问题讨论】:

  • 你使用 2.dockerfil ,但是命令使用 1.dockerfile,docker buildx build -f 1.dockerfile -t ubuntu1 .
  • docker buildx build -f 1.dockerfile -t ubuntu1 . 可以,我在我的电脑上测试过,可以。我的环境:Ubuntu 20.04,$ docker 版本 客户端:Docker 引擎 - 社区版本:20.10.21 API 版本:1.41 Go 版本:go1.18.7 Git 提交:baeda1f 内置:2022 年 10 月 25 日星期二 18:02:21 OS/Arch:linux /amd64 上下文:默认实验:true ....
  • 当然这是一个错字,我更新了构建 2.dockerfile 的命令

标签: docker docker-build buildx


【解决方案1】:

好的,找到了部分解决方案,我需要按照 the docs 添加 --output type=docker。这会将 docker 放入图像列表中。但是我仍然不能在第二个 docker 中使用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-21
    • 2016-10-12
    • 1970-01-01
    • 1970-01-01
    • 2019-10-04
    相关资源
    最近更新 更多