moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
8.06k stars 1.13k forks source link

[containerd] manifest list pointing to schema1 not supported #878

Open moikot opened 5 years ago

moikot commented 5 years ago

I can successfully pull arm64/v8 Golang images using

docker pull arm64v8/golang:1.12-alpine

But when I try to build an image specifying arm64/v8 as the platform using buildkit the build fails with error:

error: failed to solve: rpc error: code = Unknown desc = failed to copy: httpReaderSeeker: failed open: could not fetch content descriptor sha256:7cf1f7ccf392bd834eb91f02892f48992d3c2ba292c2198315a4637bb9454c30 (application/vnd.docker.distribution.manifest.v1+json) from remote: not found

I inspected the manifests for golang using weshigbee/manifest-tool and it reported that there are no layers for arm64/v8 so I submitted an issue for golang.

But the issue was investigated and @yosifkit found out that it was a glitch on Github and some manifests were pushed as v2 and some as v1 and an issue was raised for manifest-tool too.

Would it be possible to handle such situation, when some manifests are using v2 and some v1, correctly in buildkit?

tonistiigi commented 5 years ago

I'm not quite sure what command you are running. Tried building from arm64v8/golang:1.12-alpine with both buildctl and docker and didn't have issues. Also arm64v8/golang:1.12-alpine is not a manifest list at all. It's possible that the image has changed after you tried to build.

We should avoid v1 images for whatever reason in the upload process. They have been discouraged for more than 3 years now and there is absolutely no reason for ever creating them. docker engine codebase still not giving an error for them isn't really an argument. A future version of docker will stop supporting them, the question is only when.

moikot commented 5 years ago

Thank you for looking at this issue. It seems like golang:1.12-alpine finally got linux/arm64 v2 manifest. At least I can see it executing docker run --rm weshigbee/manifest-tool inspect golang:1.12-alpine. But for some reason, I still can't build.

My Dockerfile

FROM golang:1.12.0-alpine

How I start buildkit

export BUILDKIT_HOST=tcp://0.0.0.0:1234
sudo docker run --privileged linuxkit/binfmt:v0.6
sudo docker run -d --privileged \
    -p "1234":"1234" \
    --name buildkit moby/buildkit:latest \
    --addr "tcp://0.0.0.0:1234" \
    --oci-worker-platform "linux/arm64"

How I'm trying to build

buildctl build \
    --frontend dockerfile.v0 \
    --frontend-opt platform="linux/arm64" \
    --local dockerfile=. \
    --local context=.
tonistiigi commented 5 years ago

@moikot I do see the issue with golang:1.12.0-alpine. Could you report this to https://github.com/containerd/containerd/ please cause that's where its originating.

» ctr image pull --platform=linux/arm64 docker.io/library/golang:1.12.0-alpine
docker.io/library/golang:1.12.0-alpine: resolving      |--------------------------------------|
elapsed: 0.9 s                          total:   0.0 B (0.0 B/s)                             docker.io/library/golang:1.12.0-alpine:                                        resolved      docker.io/library/golang:1.12.0-alpine:                                          resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:6c143f415448f883ed034529162b3dc1c85bb2967fdd1579a873567b22bcb790:   done           |++++++++++++++++++++++++++++++++++++++|
unknown-sha256:7cf1f7ccf392bd834eb91f02892f48992d3c2ba292c2198315a4637bb9454c30: waiting        |--------------------------------------|
elapsed: 1.1 s                                                                   total:  2.3 Ki (2.1 KiB/s)
WARN[0001] reference for unknown type: application/vnd.docker.distribution.manifest.v1+json
ctr: failed to copy: httpReaderSeeker: failed open: could not fetch content descriptor sha256:7cf1f7ccf392bd834eb91f02892f48992d3c2ba292c2198315a4637bb9454c30 (application/vnd.docker.distribution.manifest.v1+json) from remote: not found
moikot commented 5 years ago

Done