简体   繁体   中英

Docker unable to login to Nexus docker registry (hosted)

I have configured the Docker registry (hosted) in the nexus server https://nexus.mycompany.com and have enabled the HTTP connector port on 8083.

I am unable to push images to the Docker repository from my Jenkins server.

I have added nexus server in insecure registries in Jenkins server.x

$ cat /etc/docker/daemon.json

{
  "insecure-registries": [
     "nexus.mycompany.com:8082",
     "nexus.mycompany.com:8083"
  ]
}

when i run

docker login -u admin -p xxxxx nexus.mycompany.com:8083

I get the below error

WARNING. Using --password via the CLI is insecure. Use --password-stdin: Error response from daemon: Get http://nexus.mycompany.com:8083/v2/ : dial tcp xxx.xx.0.xx:8083: connect: no route to host

I have configured SSL vis apache httpd below is my conf.d file in Jenkins server. Am I missing something in proxy settings?


<VirtualHost xxx.xx.x.xx:80>

ServerName jenkins.mycompany.com
ProxyRequests Off
RewriteEngine on

ProxyPass /jenkins http://xxx.xx.x.xx:8080/jenkins
ProxyPassReverse /jenkins  http://xxx.xx.x.xx:8080/jenkins


ProxyPreserveHost On

LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
ErrorLog  /var/log/httpd/jenkins-error.log
CustomLog  /var/log/httpd/jenkins-access.log combined

#Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

</VirtualHost>



<VirtualHost xxx.xx.x.xx:443>
ServerName jenkins.mycompany.com

TimeOut 900

<Directory />
Order allow,deny
Allow from all
</Directory>

SSLEngine On
SSLCertificateKeyFile   /etc/httpd/conf.d/.ssl/mycompany.com.key
SSLCertificateFile      /etc/httpd/conf.d/.ssl/mycompany.com.crt
SSLCertificateChainFile /etc/httpd/conf.d/.ssl/mycompany.comca.crt

ProxyRequests Off
RewriteEngine on

ProxyPass /jenkins  http://xxx.xx.x.xx:8080/jenkins
ProxyPassReverse /jenkins  http://xxx.xx.x.xx:8080/jenkins


ProxyPreserveHost On
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
ErrorLog  /var/log/httpd/jenkins-ssl-error.log
CustomLog  /var/log/httpd/jenkins-ssl-access.log combined

</VirtualHost>```



I can connect to the Docker registry from the nexus server.
Jenkins server ports 
Below are my port settings on the Jenkins server.

```Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:25                  :::*                    LISTEN      -
tcp6       0      0 :::443                  :::*                    LISTEN      -
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      15505/java
tcp6       0      0 :::8009                 :::*                    LISTEN      15505/java
tcp6       0      0 :::8080                 :::*                    LISTEN      15505/java
tcp6       0      0 :::80                   :::*                    LISTEN      -
.```

It was simple port Issue.though the port 8083 was listening it was not accepting traffic.

I edited the iptables added 8083 to accept inbound traffic and i was able to login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM