I set up a hosted Docker repo in our internal Nexus server at https://nexus.mycompany.com/repository/docker, and setup a user with r/w access to it. However when trying to log into it, either via command line or via Groovy scripts, I get
Error response from daemon: login attempt to https://nexus.mycompany.com/v2/ failed with status: 404 Not Found
Why is v2 being added to the URL?
For example, I use the Docker plugin for a Jenkins pipeline, and do this
docker.withRegistry('https://nexus.mycompany.com/repository/docker/', 'secret_creds') {
// Build and push Docker images
}
...and get the above error when I run my pipeline.
That is because of how Docker was designed and unfortunately we cannot change this in Nexus Repository without breaking compatibility with Docker clients. If you’re interested in learning about about this you can check the Docker API specification: Registry | Docker Docs
Because of that nuance you have to either use a port connector or a reverse proxy to be able to access repository content with Docker client. You can read more in our documentation to make the best choice for your situation: Docker Registry
Nexus v3.28.1
I would like to kindly urge you to update to the latest version, because 3.28.1 is really old, and our recent releases included some significant fixes for Docker repositories. You can find what’s new and fixed in our Release Notes