docker 拉清单未知 blob 错误
docker pull manifest unknown blob errors
我目前正在尝试将 nexus 设置为 docker 图像的私有注册表,并且已经能够通过 nexus 存储库登录、推送、拉取和搜索。
目前,如果在 nexus 托管存储库中不可用,我们只能从 docker 中拉取图像。我们面临的错误范围从 blob unknown
到 manifest unknown
。
[root@server1446 ~]$ docker pull server908.int.org.com:6666/centos
Using default tag: latest
Trying to pull repository server908.int.org.com:6666/centos ...
manifest unknown: manifest unknown
尝试参考 [Setup-Docker-Private-Registry-in-Nexus-Repository-OSS-3.0.0][1]
[1]: https://github.com/TerrenceMiao/nexus/wiki/Setup-Docker-Private-Registry-in-Nexus-Repository-OSS-3.0.0 使用 docker(group) 设置 docker(proxy) 和 docker(hosted) repo 但它抛出 blob unknown to registry
错误。
docker(hosted) 配置了 http 端口 4444 & docker(group) 配置了 http 端口 5555,我们在 nginx 配置中使用了相同的配置,如下所示,但似乎都不起作用。
server {
listen 6666;
server_name server908.int.org.com;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/orgnexus.crt;
ssl_certificate_key /etc/ssl/certs/orgnexus.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
client_max_body_size 1G;
chunked_transfer_encoding on;
location / {
access_log /var/log/nginx/docker.log;
proxy_set_header Host $http_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://server908.int.org.com:5555;
proxy_read_timeout 90;
}
我们在“/etc/sysconfig/docker”文件中对以下条目进行了评论。
http_proxy=http://x.x.x.x:3128
https_proxy=http://x.x.x.x:3128
以下是使它正常工作的配置。
server {
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffering off;
tcp_nodelay on;
server_tokens off;
client_max_body_size 1G;
listen 80;
server_name box.company.net;
location / {
rewrite ^(.*) https://box.company.net 301;
}
}
server {
listen 443;
server_name box.company.net;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/certs/ssl.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_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://box.company.net:8081;
proxy_read_timeout 90;
}
}
# correlates to your nexus http connector
server {
listen 6666;
server_name box.company.net;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/certs/ssl.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
client_max_body_size 1G;
chunked_transfer_encoding on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_method !~* GET) {
proxy_pass http://box.company.net:4444;
}
if ($request_method = GET) {
proxy_pass http://box.company.net:5555;
}
proxy_read_timeout 90;
}
}
在带有“/etc/default/docker”文件的条目下方进行评论。
http_proxy=http://x.x.x.x:3128
https_proxy=http://x.x.x.x:3128
重启 Nginx。
执行登录
[test@server ~]$ docker login -u admin -p admin123 box.company.net:6666
Login Succeeded
Post登录一个文件名"config.json"将在“.docker”目录下创建
[test@server ~]$ cat ~/.docker/config.json
{
"auths": {
"box.company.net:6666": {
"auth": "YWRtaW46YWRtaW4xMjM="
}
}
}
在 docker 中心搜索可用的图像。
[test@server ~]$ docker search box.company.net:6666/ubuntu
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
company.net box.company.net:6666/ubuntu Ubuntu is a Debian-based Linux operating s... 6186 [OK]
通过 Nexus 代理从 docker 中心拉取图像。
[test@server ~]$ docker pull box.company.net:6666/ubuntu
Using default tag: latest
Trying to pull repository box.company.net:6666/ubuntu ...
sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4: Pulling from box.company.net:6666/ubuntu
75c416ea735c: Pull complete
c6ff40b6d658: Pull complete
a7050fc1f338: Pull complete
f0ffb5cf6ba9: Pull complete
be232718519c: Pull complete
Digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4
Status: Downloaded newer image for box.company.net:6666/ubuntu:latest
标记拉取的镜像
docker tag box.company.net:6666/ubuntu:latest box.company.net:6666/ubuntu:1
推送到 NexusHostedRepo(端口:4444)
[test@server ~]$ docker push box.company.net:6666/ubuntu:1
The push refers to a repository [box.company.net:6666/ubuntu]
0566c118947e: Pushed
6f9cf951edf5: Pushed
182d2a55830d: Pushed
latest: digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4 size: 1357
从 Nexus Repo 拉取(这应该比从 docker hub 拉取快)
[test@server ~]$ docker pull box.company.net:6666/ubuntu:1
Trying to pull repository box.company.net:6666/ubuntu ...
sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4: Pulling from server908.int.org.com:6666/ubuntu
75c416ea735c: Pull complete
c6ff40b6d658: Pull complete
a7050fc1f338: Pull complete
Digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4
Status: Downloaded newer image for box.company.net:6666/ubuntu:1
-------------------------------------------- ----------------------------------
还要确保在 Nexus SSL 证书部分添加代理服务器证书。
keytool -J-Dhttps.proxyHost=<proxy_hostname> -J-Dhttps.proxyPort=<proxy_port> -printcert -rfc -sslserver <remote_host_name:remote_ssl_port>
将 proxy_hostname
和 proxy_port
替换为 Nexus 在管理 -> 服务器下配置的 HTTP 代理服务器。将 remote_host_name:remote_ssl_port
替换为存在认证问题的远程主机和端口之一。如果它是默认的 443,您可以省略端口。对于 docker,它将是 registry-1.docker.io:443
您应该看到至少有两个由上述命令打印的条目。将最后打印的证书内容全部复制到剪贴板。这应该是您的代理服务器的证书,添加到证书链的末尾。
复制的证书内容应以 -----BEGIN CERTIFICATE----- 开头,以 -----END CERTIFICATE----- 结尾。
然后在 Nexus UI 中,转到管理 -> SSL 证书并单击添加...,然后选择粘贴 PEM。将证书内容粘贴到打开的对话框中。
单击加载证书。在接下来的 window 中验证证书内容。验证列出的颁发者详细信息来自您的代理服务器证书。满意后单击添加证书。
希望这对您有所帮助。
我目前正在尝试将 nexus 设置为 docker 图像的私有注册表,并且已经能够通过 nexus 存储库登录、推送、拉取和搜索。
目前,如果在 nexus 托管存储库中不可用,我们只能从 docker 中拉取图像。我们面临的错误范围从 blob unknown
到 manifest unknown
。
[root@server1446 ~]$ docker pull server908.int.org.com:6666/centos
Using default tag: latest
Trying to pull repository server908.int.org.com:6666/centos ...
manifest unknown: manifest unknown
尝试参考 [Setup-Docker-Private-Registry-in-Nexus-Repository-OSS-3.0.0][1]
[1]: https://github.com/TerrenceMiao/nexus/wiki/Setup-Docker-Private-Registry-in-Nexus-Repository-OSS-3.0.0 使用 docker(group) 设置 docker(proxy) 和 docker(hosted) repo 但它抛出 blob unknown to registry
错误。
docker(hosted) 配置了 http 端口 4444 & docker(group) 配置了 http 端口 5555,我们在 nginx 配置中使用了相同的配置,如下所示,但似乎都不起作用。
server {
listen 6666;
server_name server908.int.org.com;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/orgnexus.crt;
ssl_certificate_key /etc/ssl/certs/orgnexus.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
client_max_body_size 1G;
chunked_transfer_encoding on;
location / {
access_log /var/log/nginx/docker.log;
proxy_set_header Host $http_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://server908.int.org.com:5555;
proxy_read_timeout 90;
}
我们在“/etc/sysconfig/docker”文件中对以下条目进行了评论。
http_proxy=http://x.x.x.x:3128
https_proxy=http://x.x.x.x:3128
以下是使它正常工作的配置。
server {
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffering off;
tcp_nodelay on;
server_tokens off;
client_max_body_size 1G;
listen 80;
server_name box.company.net;
location / {
rewrite ^(.*) https://box.company.net 301;
}
}
server {
listen 443;
server_name box.company.net;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/certs/ssl.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_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://box.company.net:8081;
proxy_read_timeout 90;
}
}
# correlates to your nexus http connector
server {
listen 6666;
server_name box.company.net;
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/certs/ssl.key;
ssl_ciphers HIGH:!kEDH:!ADH:!MD5:@STRENGTH;
ssl_session_cache shared:TLSSSL:16m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
client_max_body_size 1G;
chunked_transfer_encoding on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_method !~* GET) {
proxy_pass http://box.company.net:4444;
}
if ($request_method = GET) {
proxy_pass http://box.company.net:5555;
}
proxy_read_timeout 90;
}
}
在带有“/etc/default/docker”文件的条目下方进行评论。
http_proxy=http://x.x.x.x:3128
https_proxy=http://x.x.x.x:3128
重启 Nginx。
执行登录
[test@server ~]$ docker login -u admin -p admin123 box.company.net:6666
Login Succeeded
Post登录一个文件名"config.json"将在“.docker”目录下创建
[test@server ~]$ cat ~/.docker/config.json
{
"auths": {
"box.company.net:6666": {
"auth": "YWRtaW46YWRtaW4xMjM="
}
}
}
在 docker 中心搜索可用的图像。
[test@server ~]$ docker search box.company.net:6666/ubuntu
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
company.net box.company.net:6666/ubuntu Ubuntu is a Debian-based Linux operating s... 6186 [OK]
通过 Nexus 代理从 docker 中心拉取图像。
[test@server ~]$ docker pull box.company.net:6666/ubuntu
Using default tag: latest
Trying to pull repository box.company.net:6666/ubuntu ...
sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4: Pulling from box.company.net:6666/ubuntu
75c416ea735c: Pull complete
c6ff40b6d658: Pull complete
a7050fc1f338: Pull complete
f0ffb5cf6ba9: Pull complete
be232718519c: Pull complete
Digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4
Status: Downloaded newer image for box.company.net:6666/ubuntu:latest
标记拉取的镜像
docker tag box.company.net:6666/ubuntu:latest box.company.net:6666/ubuntu:1
推送到 NexusHostedRepo(端口:4444)
[test@server ~]$ docker push box.company.net:6666/ubuntu:1
The push refers to a repository [box.company.net:6666/ubuntu]
0566c118947e: Pushed
6f9cf951edf5: Pushed
182d2a55830d: Pushed
latest: digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4 size: 1357
从 Nexus Repo 拉取(这应该比从 docker hub 拉取快)
[test@server ~]$ docker pull box.company.net:6666/ubuntu:1
Trying to pull repository box.company.net:6666/ubuntu ...
sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4: Pulling from server908.int.org.com:6666/ubuntu
75c416ea735c: Pull complete
c6ff40b6d658: Pull complete
a7050fc1f338: Pull complete
Digest: sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4
Status: Downloaded newer image for box.company.net:6666/ubuntu:1
-------------------------------------------- ----------------------------------
还要确保在 Nexus SSL 证书部分添加代理服务器证书。
keytool -J-Dhttps.proxyHost=<proxy_hostname> -J-Dhttps.proxyPort=<proxy_port> -printcert -rfc -sslserver <remote_host_name:remote_ssl_port>
将 proxy_hostname
和 proxy_port
替换为 Nexus 在管理 -> 服务器下配置的 HTTP 代理服务器。将 remote_host_name:remote_ssl_port
替换为存在认证问题的远程主机和端口之一。如果它是默认的 443,您可以省略端口。对于 docker,它将是 registry-1.docker.io:443
您应该看到至少有两个由上述命令打印的条目。将最后打印的证书内容全部复制到剪贴板。这应该是您的代理服务器的证书,添加到证书链的末尾。
复制的证书内容应以 -----BEGIN CERTIFICATE----- 开头,以 -----END CERTIFICATE----- 结尾。
然后在 Nexus UI 中,转到管理 -> SSL 证书并单击添加...,然后选择粘贴 PEM。将证书内容粘贴到打开的对话框中。
单击加载证书。在接下来的 window 中验证证书内容。验证列出的颁发者详细信息来自您的代理服务器证书。满意后单击添加证书。
希望这对您有所帮助。