docker login failed

Hello Team,

I have installed nexus-3.69.0-02 on standalone server. I have also created docker hosted Repositories URL:- https://testnexusrepo.xxx.com/repository/dockertest/

and I have also installed nginx on the same server.

================================================
please check details of nginx file

server {
listen *:443 ssl http2;
server_name testnexusrepo.xxx.com;

    # allow large uploads of files - refer to nginx documentation
    client_max_body_size 1G;

    # optimize downloading files larger than 1G - refer to nginx doc before adjusting
    #proxy_max_temp_file_size 2G;

    ssl_certificate      /home/k8testadmin/testnexus.xxx.com.crt;
    ssl_certificate_key  /home/k8testadmin/testnexus.xxx.com.key;

    location / {
        proxy_pass http://[ip address of server]:8081/;
        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 "https";
    }

    location /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 "https";
        proxy_pass http://testnexusrepo.xxx.com:8081/repository/dockertest/$request_uri;

}
location /v1 {
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 “https”;
proxy_pass http://testnexusrepo.xxx.com:8081/repository/dockertest/$request_uri;
}
}

1:- My nginx service is running
2:- nexus service is also running

But when I try to login using below command its failing

root@master1:~# docker login https://testnexusrepo.XXX.com
Username: admin
Password:
time=“2024-09-20T13:49:22+05:30” level=info msg=“Error logging in to endpoint, trying next endpoint” error=“login attempt to https://testnexusrepo.XXX.com/v2/ failed with status: 502 Bad Gateway”
login attempt to https://testnexusrepo.XXX.com/v2/ failed with status: 502 Bad Gateway
root@master1:~#

Issue is because of this developer is not able to pull push the images.

Can anyone please help me what i am missing…

I’d suggest taking a look at the logs (nexus.log and request.log) from Nexus to see if there are errors which might indicate what is happening.

Hi Rahul,

Indeed the 502 indicates your issue is not with authentication. So please find out why it breaks. Did you try just “docker login testnexusrepo.xxx.com” without any other client settings?

Note: HTTPS is implied by default, no need to set this on login.