10

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?

Sagi Mann
  • 2,967
  • 6
  • 39
  • 72
  • you use 2.dockerfil , but command use 1.dockerfile, `docker buildx build -f 1.dockerfile -t ubuntu1 .` – life888888 Dec 07 '22 at 11:54
  • `docker buildx build -f 1.dockerfile -t ubuntu1 .` is ok, I test it on my pc, it ok. My Env: Ubuntu 20.04, $ docker version Client: Docker Engine - Community Version: 20.10.21 API version: 1.41 Go version: go1.18.7 Git commit: baeda1f Built: Tue Oct 25 18:02:21 2022 OS/Arch: linux/amd64 Context: default Experimental: true .... – life888888 Dec 07 '22 at 11:55
  • this was a typo of course, I updated the command to build 2.dockerfile – Sagi Mann Dec 10 '22 at 07:16
  • Refer to [this comment](https://github.com/docker/buildx/issues/59#issuecomment-1168619521). You need to use the `--load` flag, to load each of the images built, so that they show up in the list returned by `docker images` command – devatherock May 25 '23 at 03:52

1 Answers1

14

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.

Sagi Mann
  • 2,967
  • 6
  • 39
  • 72