buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Dosen't work build from privite repository with DOCKER_BUILDKIT

Open mrlioncub opened this issue 2 years ago • 4 comments

Contributing guidelines

Description

Dosen't work with DOCKER_BUILDKIT from private repo:

docker build -t myalpinenew -f Dockerfile .

and work without DOCKER_BUILDKIT:

$ DOCKER_BUILDKIT=0 docker build -t myalpinenew -f Dockerfile .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
            environment-variable.

Sending build context to Docker daemon  4.096kB
Step 1/1 : FROM registry.domain.com/myalpine
latest: Pulling from myalpine
31e352740f53: Already exists 
Digest: sha256:d9aa342b462fefc177e8e9d0dbb84ff49a0db3d80a83d852eedb70430097dd09
Status: Downloaded newer image for registry.domain.com/myalpine:latest
 ---> a53e66d362fa
Successfully built a53e66d362fa
Successfully tagged myalpinenew:latest

Expected behaviour

Build without errors

Actual behaviour

$ docker build -t myalpinenew -f Dockerfile .
[+] Building 0.0s (3/3) FINISHED                                                                                                                                                                                        docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                              0.0s
 => => transferring dockerfile: 70B                                                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                                                                                                   0.0s
 => ERROR [internal] load metadata for registry.domain.com/myalpine:latest                                                                                                                                                        0.0s
------
 > [internal] load metadata for registry.domain.com/myalpine:latest:
------
Dockerfile:1
--------------------
   1 | >>> FROM registry.domain.com/myalpine
--------------------
ERROR: failed to solve: registry.domain.com/myalpine: registry.domain.com/myalpine:latest: not found

Buildx version

github.com/docker/buildx v0.11.2 9872040

Docker info

Client: Docker Engine - Community
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 26
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: ov2cmjvl3pvbj3khs0hlpuger
  Is Manager: true
  ClusterID: b2u42jt93qdrnmwhedrdrnva0
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 172.16.74.98
  Manager Addresses:
   172.16.74.98:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.19.0-50-generic
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 31.2GiB
 Name: wks-chl-77
 ID: 7QNB:HYZQ:MVGL:4TJH:WHQX:XOFL:7UCX:HG75:WBCV:AOAG:Y4KB:CO6O
 Docker Root Dir: /data/var_lib_docker
 Debug Mode: false
 Username: ltarasyuk
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Builders list

NAME/NODE              DRIVER/ENDPOINT             STATUS  BUILDKIT             PLATFORMS
intelligent_meitner *  docker-container                                         
  intelligent_meitner0 unix:///var/run/docker.sock running v0.11.6              linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
default                docker                                                   
  default              default                     running v0.11.6+0a15675913b7 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386

Configuration

FROM registry.domain.com/myalpine

mrlioncub avatar Jul 28 '23 04:07 mrlioncub

What's the output of:

docker buildx imagetools inspect registry.domain.com/myalpine

crazy-max avatar Aug 03 '23 07:08 crazy-max

$ docker buildx imagetools inspect registry.domain.com/myalpine
ERROR: registry.domain.com/myalpine:latest: not found
$ docker image inspect registry.domain.com/myalpine 
[
    {
        "Id": "sha256:a53e66d362fafda712bcf034b790c7ffd3b96125b85bb95636a7cb8a88f68f77",
        "RepoTags": [
            "registry.domain.com/myalpine:latest"
        ],
        "RepoDigests": [
            "registry.domain.com/myalpine@sha256:d9aa342b462fefc177e8e9d0dbb84ff49a0db3d80a83d852eedb70430097dd09"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2023-06-14T20:41:59.079795125Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh"
            ],
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 7331611,
        "VirtualSize": 7331611,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/data/var_lib_docker/overlay2/c3344cd3bf36094aba391da231ad70159517d024f40c1cc1b960e091484df2bd/merged",
                "UpperDir": "/data/var_lib_docker/overlay2/c3344cd3bf36094aba391da231ad70159517d024f40c1cc1b960e091484df2bd/diff",
                "WorkDir": "/data/var_lib_docker/overlay2/c3344cd3bf36094aba391da231ad70159517d024f40c1cc1b960e091484df2bd/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:78a822fe2a2d2c84f3de4a403188c45f623017d6a4521d23047c9fbb0801794c"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

mrlioncub avatar Aug 04 '23 09:08 mrlioncub

Get the same error when use buildx with a image from private registry. Any plan to fix this bug?

zijin520 avatar Feb 05 '24 00:02 zijin520

I got the same error using buildx with an image from a custom/private docker registry:

DOCKER_BUILDKIT=1 docker  build  -t test:alpine .
[+] Building 0.0s (2/2) FINISHED                                                                                                                                                                           docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                 0.0s
 => => transferring dockerfile: 97B                                                                                                                                                                                  0.0s
 => ERROR [internal] load metadata for nexus.viridian.ltd/vdb-netcore:6.0.5-finconecta-alpine   

Inspecting the image with imagetools:

docker buildx imagetools inspect nexus.viridian.ltd/viridian-java:8.0.3-base
ERROR: nexus.viridian.ltd/viridian-java:8.0.3-base: not found

I assume the error is only present with custom registries. I tried uploading the exact same image to a public registry (docker hub) and with that new image it works.

patricioquispe avatar Apr 18 '24 15:04 patricioquispe