我正在尝试创建一个docker注册表并且发生了一些问题,我无法执行push和pull等操作,它遵循我的环境设置:
# docker container run -d -p 5000:5000 --name registry --restart=always registry:2
放在nginx代理后面,按照myregistry.conf设置:
upstream docker_registry {
server 127.0.0.1:5000;
}
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
'' 'registry/2.0';
}
server {
listen 80;
server_name registry-srv-web.myregistry.com;
ssl off;
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffering off;
tcp_nodelay on;
server_tokens off;
client_max_body_size 1G;
chunked_transfer_encoding on;
location / {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Authorization "";
proxy_set_header Host $http_host;
proxy_read_timeout 90;
proxy_pass http://docker_registry;
}
}
但我执行的任何操作,例如推或拉,都会返回错误404
docker push:
# docker push registry-srv-web.myregistry.com.br/ubuntu
The push refers to repository [registry-srv-web.myregistry.com/ubuntu]
059ad60bcacf: Preparing
8db5f072feec: Preparing
67885e448177: Preparing
ec75999a0cb1: Preparing
65bdd50ee76a: Preparing
error parsing HTTP 404 response body: invalid character 'p' after top-level value: "404 page not found\n"
docker pull:
# docker pull registry-srv-web.myregistry.com/ubuntu
Using default tag: latest
Error response from daemon: error parsing HTTP 404 response body: invalid character 'p' after top-level value: "404 page not found\n"
我还在我的docker服务器和本地配置:
{
"insecure-registries" : ["registry-srv-web.myregistry.com"]
}
我还阅读了几个类似的问题,但都没有解决。我没有使用 ssl 的一个细节,以及我在一个孤岛网络上并且我不打算发布我的注册表的事实。
关于如何解决它的任何提示?
答案 0 :(得分:0)
我认为docker无法访问Registry-srv-web.myregistry.com 您应该通过telnet注册表主机进行确认。