github.com/lusis/distribution@v2.0.1+incompatible/contrib/compose/nginx/registry.conf (about)

     1  # Docker registry proxy for api versions 1 and 2
     2  
     3  upstream docker-registry {
     4    server registryv1:5000;
     5  }
     6  
     7  upstream docker-registry-v2 {
     8    server registryv2:5000;
     9  }
    10  
    11  # No client auth or TLS
    12  server {
    13    listen 5000;
    14    server_name localhost;
    15  
    16    # disable any limits to avoid HTTP 413 for large image uploads
    17    client_max_body_size 0;
    18  
    19    # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
    20    chunked_transfer_encoding on;
    21  
    22    location /v2/ {
    23      # Do not allow connections from docker 1.5 and earlier
    24      # docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
    25      if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
    26        return 404;
    27      }
    28      
    29      # The docker client expects this header from the /v2/ endpoint.
    30      more_set_headers 'Docker-Distribution-Api-Version: registry/2.0';
    31  
    32      include               docker-registry-v2.conf;
    33    }
    34  
    35    location / {
    36      include               docker-registry.conf;
    37    }
    38  }
    39