8000 registry setup with nginx proxy by gyulaweber · Pull Request #652 · distribution/distribution · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

registry setup with nginx proxy #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions contrib/registry-with-auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Docker registry with authentication / tls

1. create htaccess file in nginx/htpassd
2. update your nginx/nginx.conf
3. add your certs ( nginx/certs/ssl.key and ssl.crt )

### Build the nginx image
```
docker-compose build
```

### Start nginx and registry
```
docker-compose up

```

17 changes: 17 additions & 0 deletions contrib/registry-with-auth/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
registry:
restart: always
image: registry:2
ports:
environment:
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /var/lib/registry
volumes:
- ./registry-data:/var/lib/registry

regfront:
restart: always
build: ./nginx/
ports:
- 443:443
links:
- registry:registry

9 changes: 9 additions & 0 deletions contrib/registry-with-auth/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM nginx

COPY certs /etc/ssl/certs
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY docker-registry.conf /etc/nginx/docker-registry.conf
COPY htpasswd /etc/nginx/htpasswd

EXPOSE 443

6 changes: 6 additions & 0 deletions contrib/registry-with-auth/nginx/docker-registry.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
proxy_pass http://docker-registry;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header Authorization ""; # see https://github.com/dotcloud/docker-registry/issues/170
proxy_read_timeout 900;

Empty file.
43 changes: 43 additions & 0 deletions contrib/registry-with-auth/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

upstream docker-registry {
server registry:5000;
}

server {
listen 443;
server_name example.org;

ssl on;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/certs/ssl.key;

client_max_body_size 0;
chunked_transfer_encoding on;

location / {
include docker-registry.conf;
}

location /_ping {
auth_basic off;
include docker-registry.conf;
}

location /v1/_ping {
auth_basic off;
include docker-registry.conf;
}
location /v2/ {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}

proxy_pass http://docker-registry;

proxy_read_timeout 900;

add_header 'Docker-Distribution-Api-Version:' 'registry/2.0' always;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
}
}
0