Sagi Mann
Sagi Mann

Reputation: 3610

docker buildx fails to show result in image list

The following commands do not show the output ubuntu1 image:

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

1.dockerfile:

FROM ubuntu:latest
RUN echo "my ubuntu"

Plus, I cannot use the image in FROM statements in other docker files (both builds are on my local Windows box):

2.dockerfile:

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

Any idea what's going on? How can I see what buildx prepared and reference one image in another dockerfile?

Upvotes: 27

Views: 25043

Answers (2)

I.Yan
I.Yan

Reputation: 71

I had the same problem while working in a pipeline of CI/CD, it was really difficult to understand why it was happening.

But as devatherock mentioned in this comment, you need to only add the --load flag to your build command.

Upvotes: 4

Sagi Mann
Sagi Mann

Reputation: 3610

Ok found a partial solution, I need to add --output type=docker as per the docs. This puts the docker in the image list. But I still cannot use it in the second docker.

Upvotes: 33

Related Questions