Docker登录Artifactory仓库遇404及TLS握手超时问题求助
Let’s work through your two login errors step by step—since you’re already familiar with Docker, we’ll focus on Artifactory-specific configurations that are likely tripping you up.
First Error: 404 Not Found on https://dev.artifactory.com/v2/
This error happens because Artifactory doesn’t expose Docker’s v2 API directly at the root domain by default. Docker repositories in Artifactory require you to target the specific repository key in your request path.
Fix Steps:
Verify your Artifactory Docker Repository Key
Log into your Artifactory UI, navigate to Repositories > Local/Remote/Virtual, and find the Docker repository you want to use. Note its Repository Key (e.g.,docker-localfor a local repo,docker-remotefor a remote, ordocker-virtualfor a virtual repo).Adjust your Nginx Proxy Configuration
Artifactory needs specific Nginx location blocks to route Docker requests correctly. Replace the generic config you might have with something like this (swapdocker-localwith your actual repository key):# Route direct repository requests location /docker-local/ { proxy_pass http://localhost:8081/artifactory/docker-local/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } # Route Docker v2 API requests location /v2/ { proxy_pass http://localhost:8081/artifactory/api/docker/docker-local/v2/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }After updating, restart Nginx to apply changes.
Test the Login with the Correct Context
Now try logging in without specifying the/v2/path—Docker will automatically use the correct API path if your proxy is set up right:docker login dev.artifactory.com
Second Error: TLS Handshake Timeout on port 80
When you run docker login dev.artifactory.com:80, Docker defaults to using HTTPS to connect to port 80—but port 80 is typically for unencrypted HTTP traffic. This mismatch causes the TLS handshake timeout.
Fix Options:
Force HTTP for the login
If your Nginx is running HTTP on port 80, use the--httpflag to tell Docker not to use TLS:docker login --http dev.artifactory.com:80Switch to HTTPS (Recommended)
For production use, set up HTTPS on port 443 in Nginx with a valid SSL certificate (self-signed works for testing, but use a trusted cert for production). Once configured, you can log in normally without specifying a port:docker login dev.artifactory.com
Additional Checks to Rule Out Other Issues
- Confirm Artifactory is running: Run
curl http://localhost:8081/artifactory/api/system/pingon the Artifactory server—you should get a response ofok. - Check network connectivity: From your Docker client machine, test if you can reach the Artifactory server with
ping dev.artifactory.comandtelnet dev.artifactory.com 80(or 443). If these fail, you might have a firewall or DNS issue to resolve. - Verify user permissions: Ensure the Artifactory user you’re logging in with has Read/Deploy permissions for the target Docker repository. You can check this in the Artifactory UI under Admin > Users > [Your User] > Permissions.
内容的提问来源于stack exchange,提问作者arjunkumarselvamani

