Search Docker Image in Gitlab container Registry

Hi everyone,

I’m here because I’ve a question about the command line docker search which looks not working on private repositories.

Currently, to see if an image exists in my gitlab-ci pipeline I use the gitlab api, but with this method I had to setup a token which have access on my repository only to read my registry :

curl -s --header "PRIVATE-TOKEN: ${REGISTRY_TOKEN_RO}" "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/registry/repositories/${REGISTRY_ID}/tags/my-image

This solution is a bit hard because for my variable REGISTRY_ID I’ve to do something else to get the good id for each image directory I’ve in my project.

The second solution that I would like to test and which is not working is to use the command

docker login registry.gitlab.com -u my-user
docker search registry.gitlab.com/my-project/my-image

But I get the following message : Error response from daemon: Unexpected status code 404

There’s a solution to make the docker search’s command works ?

Regards,