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

Manifest not found for buildah produced images #114

Closed
pidario opened this issue Nov 28, 2019 · 6 comments
Closed

Manifest not found for buildah produced images #114

pidario opened this issue Nov 28, 2019 · 6 comments

Comments

@pidario
Copy link

pidario commented Nov 28, 2019

Bug description

After creating an image using buildah instead of docker, I pushed it to my private registry (v2). Everything works perfectly (I can push and pull from it), but the UI says it cannot find the manifest, so no metadata is available.

I don't know if it is an issue with buildah, but since they claim to be OCI compliant I think that maybe docker-registry-ui should be compliant to.

How to Reproduce

create container:
buildah --name test_container from alpine:edge

finalize image:
buildah commit test_container <REGISTRY_HOST>/test_image:latest

push image:
buildah push <REGISTRY_HOST>/test_image:latest

Screenshots

2019-11-28-152951_1920x1080_scrot

System information

  • OS: Ubuntu 18.04
  • OS/Arch: linux/amd64
  • Docker registry UI:
    • Version: 1.4.0
    • Interface: static
    • Server: docker
    • Docker version: 19.03
@Joxit
Copy link
Owner

Joxit commented Dec 5, 2019

Hi, sorry for the delay.

So, if I'm understanding what you did, you have a private docker registry server and you are using buildah container client ?

The UI was built especially for docker registries, that means using docker/distribution is mandatory (or something implanting the full API). Since the UI is using the Docker Registry HTTP API V2, you can use any client as long as it can push the image through the Docker Registry HTTP API V2. If something goes wrong, this should be on your client and not the UI.

The buildah-push command says :

docker://docker-reference An image in a registry implementing the "Docker Registry HTTP API V2".

If that's true, the interface should work fine without any changes.

@pidario
Copy link
Author

pidario commented Dec 6, 2019

Thanks for the reply. Yes, you got it right. I built the image using buildah and I pushed it to my registry which is the official docker registry image.
Everything works as expected, except the fact that I can't see any additional data such as size or image history.

I guess the manifest that buildah produce has some (minor?) differences between the one produced by docker build. buildah is still in early development stage, so it might be their problem.

When I ask for the manifest by doing this request

GET
https://<REGISTRY_HOST>/v2/test_image/manifests/latest

I get the following response:

{
	"errors": [{
		"code": "MANIFEST_UNKNOWN",
		"message": "OCI manifest found, but accept header does not support OCI manifests"
	}]
}

On the other hand, when I perform the same request for a different image, the registry answers with a json file containing the manifest.

After a quick search I bumped in this merge request: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31127 which seems to fix a similar problem:

Docker Distribution v2.7.0 shipped with OCI support, but our container registry client was not updated to handle the manifest format in the HTTP Accept header. As a result, API calls to retrieve a manifest would return with an error, "OCI manifest found, but accept header does not support OCI manifests". This would result in blank fields in the container registry page and prevent tags from being deleted.

And they suggest to

add application/vnd.oci.image.manifest.v1+json to the Accept header.

This issue is also pretty interesting:
containers/buildah#575

@pidario
Copy link
Author

pidario commented Jan 10, 2020

It actually is that simple:

where you do this:
oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json');

you just need to do this instead:
oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json');.

Just tested locally and it works like a charm.

@Joxit
Copy link
Owner

Joxit commented Jan 10, 2020

Hi,

Sorry for the late reply, I cannot give long term guarantees on this feature but I added the header as you said and I checked that it still worked for images made by docker.

I'm glad it works for you 😄.

@Joxit
Copy link
Owner

Joxit commented Jan 10, 2020

Oh, and I added you in the contributors list : https://joxit.dev/docker-registry-ui/CONTRIBUTORS 😉

@pidario
Copy link
Author

pidario commented Jan 13, 2020

Thanks! Glad to be there 😎

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

No branches or pull requests

2 participants