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}" "${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 -u my-user
docker search

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 ?