IBM-Cloud / bluemix-go

Go library for accessing the Bluemix API
Apache License 2.0
37 stars 89 forks source link

BUG : registryv1.RegistryServiceAPI // Images().InspectImage() throws an error if the inspected image is in the global icr.io image registry #341

Open almasry opened 2 years ago

almasry commented 2 years ago

Hello Bluemix go team,

We are using the RegistryServiceAPI to inspect some images. The RegistryServiceAPI works just fine for any image (at any region) expect for images in the global icr.io registry.

We tried solving this by unsetting the region or setting the region to "GLOBAL" but it still doesn't work.

We still get an error when we inspect an image in the icr.io or private.icr.io registry.

The error received is something like :

 {
    "code": "CRI0106E",
    "message": "The registry in the supplied image name doesn't match the registry that the request was sent to. Correct the image name, and try again.",
    "request-id": "61373bca-f318-4066-9fb7-eba642dcd3b3"
}

We know for sure that the image name is correct and the image is already in the registry and is accessible to the given API key - as we run the ibmcloud cr image-inspect to inspect the exact same image and it doesn't throw any error.

$ ibmcloud cr  image-inspect icr.io/obs/team-name/image:1.11.1

The output is something like :

Inspecting image 'icr.io/obs/team-name/image:1.11.1'...

{
    "Id": "sha256:6a03a21e44f68xxxxxxxxxxxxxxxxxxxxxxx",
    "Parent": "",
    "Comment": "",
    "Created": "2021-11-17T09:06:33.94142403Z",
    "Container": "",
    "ContainerConfig": {
        "Hostname": "",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": null,
        "Image": "",
        "Volumes": {},
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": null
    },
    "DockerVersion": "",
    "Author": "",
    "Config": {
        "Hostname": "",
        "Domainname": "",
        "User": "1337:1337",
        "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",
            "container=oci"
        ],
        "Cmd": null,
        "ArgsEscaped": true,
        "Image": "",
        "Volumes": {},
        "WorkingDir": "",
        "Entrypoint": [
            "/usr/local/bin/pilot-discovery"
        ],
        "OnBuild": null,
    "ManifestType": "application/vnd.docker.distribution.manifest.v2+json"
}

OK


How to reproduce this bug ?

  1. Create an image in the global icr.io registry

  2. Login to ibmcloud and Inspect the image with ibmcloud cr image-inspect .. it will work just fine.

  3. Try to inspect the exact same image with the bluemix-go api - you will get an error similar to the one in the description.

Thanks in advance for your support.

hkantare commented 2 years ago

@almasry We prefer to use the service specific go sdk than bluemix-go because the priority of issues on this project is very less...Can you please use https://github.com/IBM/container-registry-go-sdk this SDK since its handled by respective service team and will always be up to date