In the gitlab you have to navigate to the api exposed by GitLab to retrieve the required details.
First of all, you need the project_id for your project. This is exposed via CI_PROJECT_ID variable by GitLab.
From the UI, navigate to the project and you would see the project id below the project name.
Once you have the project id then access the following url
https://gitlab.example.com/api/v4/projects/projectId/registry/repositories
this will give you a json response showing all repositories under the project. And you find the id from the response.
[{"id":876,"name":"","path":"group-name/subgroup-name/project-name","project_id":4099,"location":"registry.gitlab.example.com/group-name/subgroup-name/project-name","created_at":"2022-01-06T12:39:28.326Z","cleanup_policy_started_at":null}]
Now using this ID, you can further navigate to the API to fetch more details like container image tags.
for e.g.
https://gitlab.example.com/api/v4/projects/**4099**/registry/repositories/**876**/tags
or more specifically any particular tag
https://gitlab.exmaple.com/api/v4/projects/**4099**/registry/repositories/**876**/tags/**tagName**
Instead of accessing these from browser, it can be accessed from .gitlab-ci.yml as well.
for e.g. below is sample script for deleting a image tag from container registery.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags/v10.0.0"