Need example for how to login with curl using v2 docker registry api

We need to be able to tag images, it seems that we can do this using curl to download and upload a given manifest to a different location referenced by the tag we want to create. We need to authenticate in curl for this, do we use a Bearer Token? If so, how can we get one, we need an example? Or Do we simply use --user username:password https://… for every request? Do we use the URL to the repo, or the :port value used for docker login (also podman login)? Any help appreciated. I’d like to be able to tag Docker images remotely using Nexus as a registry. Thanks.

Hi!
I think this article might help you with your action via CURL: https://success.docker.com/article/how-do-i-authenticate-with-the-v2-api

I hunted around for how to do this the “right” way with things like JWTs and Bearer tokens. But turns out it’s super easy to just use the username:password@ version. Example of getting all the tags for an image:

https://username:password@privaterepo.yourdomain.com:5001/v2/image-name/tags/list

username and password come from a normal user you create in the Nexus user manager that has access to the Docker repository.