Open luxurine opened 1 year ago
I've just experienced a similar issue building a local development image and pushing it to our own GitLab Registry instance (albeit without the useful error message - I just got MANIFEST_INVALID: manifest invalid; map[]
I'm not sure how you worked around this @luxurine, but my solution was to build the Ubuntu base image myself:
# Based on: https://git.launchpad.net/cloud-images/+oci/ubuntu-base/tree/?h=focal-20.04
FROM scratch
ADD source/ubuntu-focal-oci-amd64-root.tar.gz /
I think this is related to https://github.com/GoogleContainerTools/kaniko/issues/1836
I believe this is a dupe of #1836 which was recently fixed and in the latest kaniko release (v1.15.0
). Closing, feel free to re-open if there is more to address here
I've just tried kaniko-project/executor:v1.17.0
again, still the same problem. Could you please reopen this issue? @aaron-prindle
manifest
# Dockfile
FROM ubuntu:20.04 # with OCI format
WORKDIR /app
step 1) warmup image
$ docker run -v $(pwd):/workspace gcr.io/kaniko-project/warmer:v1.17.0 --cache-dir=/workspace/cache --image=ubuntu:20.04
# output
INFO[0000] Retrieving image manifest ubuntu:20.04
INFO[0000] Retrieving image ubuntu:20.04 from registry index.docker.io
2) build and push
$ docker run -ti --rm -v `pwd`:/workspace -v `pwd`/config.json:/kaniko/.docker/config.json:ro gcr.io/kaniko-project/executor:v1.17.0-debug --cache=true --cache-dir=/workspace/cache --dockerfile=Dockerfile --destination=luxurine/demo:latest --verbosity=debug
# output
INFO[0002] Retrieving image manifest ubuntu:20.04
INFO[0002] Retrieving image ubuntu:20.04 from registry index.docker.io
INFO[0006] Found sha256:218bb51abbd1864df8be26166f847547b3851a89999ca7bfceb85ca9b5d2e95d in local cache
INFO[0006] Found manifest at /workspace/cache/sha256:218bb51abbd1864df8be26166f847547b3851a89999ca7bfceb85ca9b5d2e95d.json
INFO[0006] Built cross stage deps: map[]
INFO[0006] Retrieving image manifest ubuntu:20.04
INFO[0006] Returning cached image manifest
INFO[0006] Found sha256:218bb51abbd1864df8be26166f847547b3851a89999ca7bfceb85ca9b5d2e95d in local cache
INFO[0006] Found manifest at /workspace/cache/sha256:218bb51abbd1864df8be26166f847547b3851a89999ca7bfceb85ca9b5d2e95d.json
INFO[0006] Executing 0 build triggers
...
INFO[0006] Pushing image to luxurine/demo:latest
error pushing image: failed to push to destination luxurine/demo:latest: PUT https://index.docker.io/v2/luxurine/demo/manifests/latest: MANIFEST_INVALID: manifest invalid; mediaType in manifest should be 'application/vnd.docker.distribution.manifest.v2+json' not 'application/vnd.oci.image.manifest.v1+json'
I've also seen this with 1.18.0 and 1.19.0. Seems possibly related to newer issue #2883. We're using GitLab Container Registry and not AWS ECR.
maybe related/a regression of #2713?
Ran into this issue on executor-v1.23.2 and recent warmer-latest (doesn't report a version) to a gitlab v16.11.5 container registry.
Ran into this issue on executor-v1.23.2 and recent warmer-latest (doesn't report a version) to a gitlab v16.11.5 container registry.
@mhio here is a temporary fix you can try:
func (c *cachedImage) Manifest() (*v1.Manifest, error)
in pkg/cache/cache.go and return tabball's manifest by default. [!WARNING]
target image is always indocker
format
func (c *cachedImage) Manifest() (*v1.Manifest, error) {
if c.mfst == nil {
return c.Image.Manifest()
}
return c.mfst, nil
}
->
func (c *cachedImage) Manifest() (*v1.Manifest, error) {
mfst, err := c.Image.Manifest()
if mfst != nil {
return mfst, err
}
return c.mfst, nil
}
Thanks @luxurine we'll give that a try, disabling the warmed cache was the quick workaround.
Actual behavior When push builded image, with base image(ubuntu:20.04) cached by
warmer
, will get error:(If there is no cache for base image, image push is ok)
Expected behavior Image should be pushed successfully.
Preliminary analysis
It looks like
ubuntu:20.04
use"mediaType": "application/vnd.oci.image.manifest.v1+json"
, but dockerhub expectapplication/vnd.docker.distribution.manifest.v2+json
.The strange thing is, if build without base image cache, pushing image is just ok, I guess reasons could be:
Some proposal:
To Reproduce Steps to reproduce the behavior:
2 directories, 5 files
Additional Information
COPY bin/ /app
WORKDIR /app
ENTRYPOINT ["/app/counter"]