简体   繁体   中英

Error docker registry behind nginx, push and pull

I am trying to create a docker registry and some problems are happening, I can not perform operations like push and pull, it follows the settings of my environment:

# docker container run -d -p 5000:5000 --name registry --restart=always registry:2

put behind nginx proxy, follow the settings 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;
    }
}

but any operation I perform, such as push or pull, returns error 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"

I also configured in my docker server and local:

{
  "insecure-registries" : ["registry-srv-web.myregistry.com"]
}

I also read several similar questions posted, but none of them solved. One detail why I'm not using ssl , and the fact that I'm on an insular network and I do not intend to publish my registry.
Any hint about how to solve it?

我认为 docker 无法访问 registry-srv-web.myregistry.com 您应该 telnet registry host 来确认这一点。

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