docker - 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 -
.```
解决方案
这是简单的端口问题。虽然端口 8083 正在侦听,但它不接受流量。
我编辑了 iptables 添加了 8083 以接受入站流量,并且我能够登录。