Docker无法登录Nexus Docker注册表(托管)

时间:2020-05-15 06:23:54

标签: docker nexus3

我已在nexus服务器https://nexus.mycompany.com中配置了Docker注册表(托管),并启用了8083上的HTTP连接器端口。

我无法将映像从我的Jenkins服务器推送到Docker存储库。

我在Jenkins服务器.x的不安全注册表中添加了nexus服务器

$ cat /etc/docker/daemon.json

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

我跑步时

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

我收到以下错误

警告!通过CLI使用--password是不安全的。使用--password-stdin。 来自守护程序的错误响应:获取http://nexus.mycompany.com:8083/v2/:拨打tcp xxx.xx.0.xx:8083:connect:主机没有路由

我已经配置了SSL apache httpd,下面是我在Jenkins服务器中的conf.d文件。我在代理设置中缺少什么吗?


<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      -
.```

1 个答案:

答案 0 :(得分:0)

这是简单的端口问题。尽管端口8083正在监听,但它不接受流量。

我编辑了添加8083的iptables以接受入站流量,并且我能够登录。