Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails when FROM image isn't cached #2033

Closed
foresthoffman opened this issue Mar 22, 2021 · 8 comments · Fixed by moby/moby#42371
Closed

Build fails when FROM image isn't cached #2033

foresthoffman opened this issue Mar 22, 2021 · 8 comments · Fixed by moby/moby#42371

Comments

@foresthoffman
Copy link

I am experiencing this issue (#1271) with the current release available to me (Client version: 20.10.5). Today was the first time I've seen this occur.

I did as the folks in the previous issue mentioned (the comment), using DOCKER_BUILDKIT=0 which allowed the build to pass without errors. In my case the problematic image I am using is, busybox:ubuntu-14.04.

Reproduction Steps

To test if any other images were causing an issue, I removed all images on my machine, as well as all containers. So, docker ps -a and docker images give no results. I then ran my docker build(without DOCKER_BUILDKIT=0) using my local Dockerfile which contains the line, FROM busybox:ubuntu-14.04, and received this error:

failed to load cache key: invalid empty config file resolved for docker.io/library/busybox:ubuntu-14.04@sha256:7d3ce4e482101f0c484602dd6687c826bb8bef6295739088c58e84245845912e

After ensuring that all images and containers were removed once again, I ran docker pull on the image I needed, which succeeded. I then re-ran my build (again without DOCKER_BUILDKIT=0), and the build passed as expected.

Additional Info

So, for me, busybox:ubuntu-14.04 is not being resolved properly and prevents builds when not cached. Using DOCKER_BUILDKIT=0 allows me to skip that caching step and build without any images already pulled.

This should be fixed in Buildkit v0.7+ / Docker 20.10 and iirc from some trace I saw it was also fixed on gcr side. If you still see this open a new issue with reproduction steps.
Originally posted by @tonistiigi in #1271 (comment)

I do not know how to update my Buildkit version from v0.5.1-docker separately from Docker itself, so I cannot test the version combination quoted above. I pulled this version # from the docker info dump, so it may be incorrect, my apologies if it is.

docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.9
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:15:47 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0

docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.5.0)

Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.121-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.942GiB
Name: docker-desktop
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 41
Goroutines: 46
System Time: 2021-03-22T15:34:43.906596874Z
EventsListeners: 3
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

@zorbathut
Copy link

zorbathut commented Apr 15, 2021

Same issue here and the same workaround fix. Just to chime in with more info:

docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.9
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:14:53 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.5.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 20.10.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.121-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 7.778GiB
 Name: docker-desktop
 ID: 6CGR:RVHS:ZAPQ:6PNL:PIHW:SS6N:YRXZ:H35R:VPYG:XOJW:UH5Y:FI32
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

The image I had trouble with was phusion/baseimage:0.9.18. Note that I initially tried to build a Docker image with it through docker-compose while in Windows mode, which totally did not work, and I then switched to Linux mode and received the error:

failed to load cache key: invalid empty config file resolved for docker.io/phusion/baseimage:0.9.18@sha256:9e9b3519ecba8acbe7d5218ff53b618dd7308ef6473dd2c2b4bbbb478e2e1825

I got the same error in docker-compose and with docker-build.

On the other hand, the above user appears to be running on Linux, so it probably isn't related to the current Windows/Linux jankiness.

I won't be doing further analysis on my own since I'm unblocked thanks to the above suggestion, but I'm happy to run troubleshooting steps on request, just ping me. Hopefully this helps track it down!

@maxandersen
Copy link

just bumped into this issue too:

docker build -t dashbuilder-dev .
[+] Building 1.5s (4/5)
 => [internal] load build definition from Dockerfile                                                                            0.0s
 => => transferring dockerfile: 37B                                                                                             0.0s
 => [internal] load .dockerignore                                                                                               0.0s
 => => transferring context: 2B                                                                                                 0.0s
 => [internal] load metadata for quay.io/wsiqueir/dashbuilder-runtime:latest                                                    0.9s
 => ERROR [1/2] FROM quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef  0.0s
 => => resolve quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b655  0.0s
------
 > [1/2] FROM quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897:
------
failed to load cache key: invalid empty config file resolved for quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897

setting DOCKER_BUILDKIT=0 or pulling image first makes it work

@maxandersen
Copy link

my docker version if that helps:

Client: Docker Engine - Community
 Cloud integration: 1.0.9
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

@strowi
Copy link

strowi commented Apr 30, 2021

Can't reproduce this with 20.10.6 anymore.. maybe give that version a try.

@httpmurilo
Copy link

In tests performed on the version:
Docker version 20.10.6, build 370c289

I am faced with the same scenario.

FROM andreptb / jboss-as: 4.0.5.GA-jdk6

Log error:

=> [1/8] FROM docker.io/andreptb/jboss-as:4.0.5.GA-jdk6@sha256:372fcbd3dc9b2ca511c2638cee7e4cab7ab71a429d15b169abd7a35d77c947eb:

failed to load cache key: invalid empty config file resolved for docker.io/andreptb/jboss-as:4.0.5.GA-jdk6@sha256:372fcbd3dc9b2ca511c2638cee7e4cab7ab71a429d15b169abd7a35d77c947eb

@crazy-max
Copy link
Member

crazy-max commented May 6, 2021

@maxandersen Can repro on 20.10.6 too with:

cat > Dockerfile <<EOL
FROM quay.io/wsiqueir/dashbuilder-runtime:latest
EOL
docker build -t dashbuilder-dev .
[+] Building 1.5s (4/4) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                              0.1s
 => => transferring dockerfile: 86B                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                 0.1s
 => => transferring context: 2B                                                                                                                                                                   0.0s
 => [internal] load metadata for quay.io/wsiqueir/dashbuilder-runtime:latest                                                                                                                      0.9s
 => ERROR [1/1] FROM quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897                                                          0.0s
 => => resolve quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897                                                                0.0s
------
 > [1/1] FROM quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897:
------
error: failed to solve: rpc error: code = Unknown desc = failed to load cache key: invalid empty config file resolved for quay.io/wsiqueir/dashbuilder-runtime:latest@sha256:2402b089f637b22ded723a5aa89236b01211ad38c6f0ec145124ef71b6552897

Have also tried with busybox:ubuntu-14.04 and phusion/baseimage:0.9.18. Looks like the common pattern is they use a schemaVersion 1 manifest:

docker buildx imagetools inspect busybox:ubuntu-14.04
{
   "schemaVersion": 1,
   "name": "library/busybox",
   "tag": "ubuntu-14.04",
   "architecture": "amd64",
   "fsLayers": [
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:300273678d063c0a817349518a059c2635fc72f159dd25112ccb92ed5a22ca05"
      },
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      }
   ],
   "history": [
      {
         "v1Compatibility": "{\"id\":\"633fcd11259e8d6bccfbb59a4086b95b0d0fb44edfc3912000ef1f70e8a7bfc6\",\"parent\":\"b65c936b5fb601d680ed656b1ccf8ab857c0e5cb521043a005405c194e9a69f3\",\"created\":\"2015-09-18T17:44:53.450104575Z\",\"container\":\"3f83b1557af6e534e3391a53a0cb8b3addda747b3e5b1bd2e09e27237fce2003\",\"container_config\":{\"Hostname\":\"10fc9b8616d0\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":null,\"PublishService\":\"\",\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) CMD [\\\"/bin/sh\\\"]\"],\"Image\":\"b65c936b5fb601d680ed656b1ccf8ab857c0e5cb521043a005405c194e9a69f3\",\"Volumes\":null,\"VolumeDriver\":\"\",\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"docker_version\":\"1.8.2\",\"author\":\"Jérôme Petazzoni \\[email protected]\\u003e\",\"config\":{\"Hostname\":\"10fc9b8616d0\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":null,\"PublishService\":\"\",\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":[\"/bin/sh\"],\"Image\":\"b65c936b5fb601d680ed656b1ccf8ab857c0e5cb521043a005405c194e9a69f3\",\"Volumes\":null,\"VolumeDriver\":\"\",\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"architecture\":\"amd64\",\"os\":\"linux\",\"Size\":0}\n"
      },
      {
         "v1Compatibility": "{\"id\":\"b65c936b5fb601d680ed656b1ccf8ab857c0e5cb521043a005405c194e9a69f3\",\"parent\":\"cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff\",\"created\":\"2015-09-18T17:44:53.031029896Z\",\"container\":\"10fc9b8616d04e4b1709a218a5e70a8f70d9807bc9a5cf67fb0ad5b63f9df038\",\"container_config\":{\"Hostname\":\"10fc9b8616d0\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":null,\"PublishService\":\"\",\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) ADD file:da4d18f349d9f3a3c27cd9da5dbea914dbad4cb78cbaf46571fa1128aede538d in /\"],\"Image\":\"cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff\",\"Volumes\":null,\"VolumeDriver\":\"\",\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"docker_version\":\"1.8.2\",\"author\":\"Jérôme Petazzoni \\[email protected]\\u003e\",\"config\":{\"Hostname\":\"10fc9b8616d0\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":null,\"PublishService\":\"\",\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":null,\"Image\":\"cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff\",\"Volumes\":null,\"VolumeDriver\":\"\",\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"architecture\":\"amd64\",\"os\":\"linux\",\"Size\":5609404}\n"
      },
      {
         "v1Compatibility": "{\"id\":\"cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff\",\"created\":\"2015-04-17T22:01:05.451579326Z\",\"container\":\"39e791194498a7ee0c10e290ef51dd1ecde1f0fd83db977ddae38910b02b6fb9\",\"container_config\":{\"Hostname\":\"39e791194498\",\"Domainname\":\"\",\"User\":\"\",\"Memory\":0,\"MemorySwap\":0,\"CpuShares\":0,\"Cpuset\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"PortSpecs\":null,\"ExposedPorts\":null,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) MAINTAINER Jérôme Petazzoni \\[email protected]\\u003e\"],\"Image\":\"\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"docker_version\":\"1.6.0\",\"author\":\"Jérôme Petazzoni \\[email protected]\\u003e\",\"config\":{\"Hostname\":\"39e791194498\",\"Domainname\":\"\",\"User\":\"\",\"Memory\":0,\"MemorySwap\":0,\"CpuShares\":0,\"Cpuset\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"PortSpecs\":null,\"ExposedPorts\":null,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":null,\"Cmd\":null,\"Image\":\"\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"NetworkDisabled\":false,\"MacAddress\":\"\",\"OnBuild\":null,\"Labels\":null},\"architecture\":\"amd64\",\"os\":\"linux\",\"Size\":0}\n"
      }
   ],
   "signatures": [
      {
         "header": {
            "jwk": {
               "crv": "P-256",
               "kid": "3ELB:UFFA:3CNF:E4YB:N2TS:MQSN:IKBD:VA42:PQTL:3E3A:BHEM:BHRC",
               "kty": "EC",
               "x": "JoJDj5yGsrJE0SRXaKWgD8fs_DdFjAsPer_RUA7JvVI",
               "y": "RgNkXeKTDgCvVwe_X7dIsbNfMVHI2mLqo-DDoRlLSgQ"
            },
            "alg": "ES256"
         },
         "signature": "E1jqyMw4K71kqiQY5ezzatgNrpR_c5UYJ6Dj29dQfW0AoQELBuWY_egkL5SoVst9a2ofSFwFXQ39mubgah9S3g",
         "protected": "eyJmb3JtYXRMZW5ndGgiOjUxNDMsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAyMS0wNS0wNlQxNjoyODowMFoifQ"
      }
   ]
}

Maybe it should be taken into account here (see moby/moby#42035). WDYT @thaJeztah @tonistiigi?

@thaJeztah
Copy link
Member

Hmmm.. first of all: these images are really old, and I would highly recommend updating to something more recent if you're still using these. For example, the docker.io/library/busybox:ubuntu-14.04 was last updated more than 6 years ago (April 2015), such old images will likely contain vulnerabilities.

If you pull these images, you will see a warning about them as well;

$ ubuntu-14.04: Pulling from library/busybox
Image docker.io/library/busybox:ubuntu-14.04 uses outdated schema1 manifest format.
Please upgrade to a schema2 image for better future compatibility.
More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
a3ed95caeb02: Pull complete
300273678d06: Pull complete
Digest: sha256:7d3ce4e482101f0c484602dd6687c826bb8bef6295739088c58e84245845912e
Status: Downloaded newer image for busybox:ubuntu-14.04
docker.io/library/busybox:ubuntu-14.04

I know Docker Hub can perform automatic conversion of old v1 manifests (but there are requests to remove that functionality; docker/roadmap#173), but other registries may not be doing so.

I'm wondering if BuildKit is setting Accept headers when making requests to the registry. Here's an example using cURL;

Set the repo and tag we're interested in:

export repo=library/busybox
export tag=ubuntu-14.04

Get a token for pulling:

export token="$(curl -fsSL "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repo}:pull" | jq --raw-output '.token')";

Fetch the image manifest either with Accept: application/vnd.docker.distribution.manifest.v1+json

curl -H "Authorization: Bearer $token" \
    -H 'Accept: application/vnd.docker.distribution.manifest.v1+json' \
    "https://registry-1.docker.io/v2/${repo}/manifests/${tag}"

Or without setting an Accept header

curl -H "Authorization: Bearer $token" \
    "https://registry-1.docker.io/v2/${repo}/manifests/${tag}"

Doing this will return the deprecated v1 manifest (without conversion);

{
   "schemaVersion": 1,
   "name": "library/busybox",
   "tag": "latest",
   "architecture": "amd64",
   "fsLayers": [
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:aa2a8d90b84cb2a9c422e7005cd166a008ccf22ef5d7d4f07128478585ce35ea"
      }
   ],
   "history": [
      {
         "v1Compatibility": "{\"architecture\":\"amd64\",\"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\":[\"sh\"],\"Image\":\"sha256:2e0187ff200dd4f19eb4761e7505f1759ffd70945e4fdb3a1de1b79316374cfd\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":null},\"container\":\"22c781af50cbbf2c31a3fb57c21d4dcfb266d6691441657088db6750d4068d22\",\"container_config\":{\"Hostname\":\"22c781af50cb\",\"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\",\"-c\",\"#(nop) \",\"CMD [\\\"sh\\\"]\"],\"Image\":\"sha256:2e0187ff200dd4f19eb4761e7505f1759ffd70945e4fdb3a1de1b79316374cfd\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":{}},\"created\":\"2021-05-04T00:19:49.531663542Z\",\"docker_version\":\"19.03.12\",\"id\":\"84cb8ccbcdc1d3bc6f8a6f5a333edd1c46330aaca78a53669548e402d1b94d24\",\"os\":\"linux\",\"parent\":\"f9e6fa26c87498faaac3bbf2ca180cc48860e09b766e947953ec751ff58cc8fd\",\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"f9e6fa26c87498faaac3bbf2ca180cc48860e09b766e947953ec751ff58cc8fd\",\"created\":\"2021-05-04T00:19:49.383853296Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) ADD file:dc794c2febce9ec5b68ca4f55027eb4e7d42fc7941e15ba578585d8a166d2d13 in / \"]}}"
      }
   ],
   "signatures": [
      {
         "header": {
            "jwk": {
               "crv": "P-256",
               "kid": "MWHM:JHDO:OXRV:JO5X:M526:KM6P:4K2F:HSBD:2YRH:HLZH:2HBW:PS6E",
               "kty": "EC",
               "x": "7EiIBff9Ez60hCM6z92veGPHcOJMeyndmmG1eA4JWvk",
               "y": "1rBfT1bCfWxJE_OxsTfaO87BWwGC55NNLF-l1StiK-4"
            },
            "alg": "ES256"
         },
         "signature": "vfsVjDspELt7_ae5OWfs9d0cCsFiRHNwtqOuy_-JFI2OuVlM25aY7uP9IBHLYuMB37-4zgUNuHI3z9MpUNJVbQ",
         "protected": "eyJmb3JtYXRMZW5ndGgiOjIwODgsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAyMS0wNS0wN1QxNjowNDozNFoifQ"
      }
   ]
}

However, setting some accept headers (in this case manifest v2 and v1);

curl -H "Authorization: Bearer $token" \
    -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
    -H 'Accept: application/vnd.docker.distribution.manifest.v1+json' \
    "https://registry-1.docker.io/v2/${repo}/manifests/${tag}"

Docker Hub will return a converted v2 manifest:

{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "size": 1457,
      "digest": "sha256:c55b0f125dc65ee6a9a78307d9a2dfc446e96af7477ca29ddd4945fd398cc698"
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
         "size": 766644,
         "digest": "sha256:aa2a8d90b84cb2a9c422e7005cd166a008ccf22ef5d7d4f07128478585ce35ea"
      }
   ]
}

@rothn
Copy link

rothn commented Jun 24, 2021

I am still having this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants