L0j1k

Untitled

Jan 28th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. ----
  2. so you're going to need to also add a new volume for special directives for old clients. you need to follow these instructions, and then start a new nginx-proxy container with a new volume:
  3. -v /var/docker/nginx-proxy/vhost.d:/etc/nginx/vhost.d:ro
  4.  
  5. but first you need to do this:
  6. sudo mkdir -p /var/docker/nginx-proxy/vhost.d && cd /var/docker/nginx-proxy
  7. sudo vim vhost.d/myregistry.example.com
  8. add the following:
  9. ----
  10.  
  11. client_max_body_size 0;
  12. chunked_transfer_encoding on;
  13.  
  14. location /v2/ {
  15. # Do not allow connections from docker 1.5 and earlier
  16. # docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
  17. if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
  18. return 404;
  19. }
  20.  
  21. add_header Docker-Distribution-Api-Version "registry/2.0";
  22. #more_set_headers 'Content-Type: application/json; charset=utf-8';
  23. include vhost.d/docker-registry.conf;
  24. }
  25.  
  26. location /v1/_ping {
  27. auth_basic off;
  28. include vhost.d/docker-registry.conf;
  29. add_header X-Ping "inside /v1/_ping";
  30. add_header X-Ping "INSIDE /v1/_ping";
  31. }
  32.  
  33. location /v1/users {
  34. auth_basic off;
  35. include vhost.d/docker-registry.conf;
  36. add_header X-Users "inside /v1/users";
  37. add_header X-Users "INSIDE /v1/users";
  38. }
  39.  
  40. =================== THEN create a file: sudo vim /var/docker/nginx-proxy/vhost.d/docker-registry.conf
  41.  
  42. proxy_pass http://myregistry.mexample.com;
  43. proxy_set_header Host $http_host; # required for docker client's sake
  44. proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
  45. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  46. proxy_set_header X-Forwarded-Proto $scheme;
  47. proxy_read_timeout 900;
Advertisement
Add Comment
Please, Sign In to add comment