Skip to content
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

Added nginx example #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Docker registry v2 command line client and repo listing generator with security
- [Vulnerability Reports](#vulnerability-reports)
- [Generating Static Website for a Registry](#generating-static-website-for-a-registry)
- [Using Self-Signed Certs with a Registry](#using-self-signed-certs-with-a-registry)
- [nginx Example](#nginx-example)
- [Contributing](#contributing)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -271,6 +272,51 @@ the CA certificate directory (as root):
$ cp cacert.pem /usr/share/ca-certificates
```

### nginx Example

When setting up a private registry, you will probably want both the index and docker registry behind the same URL. nginx can help you do this:

```
server {
listen 443;
server_name docker.example.com;

# Set some reasonable timeouts
proxy_connect_timeout 5;
proxy_read_timeout 5;
proxy_send_timeout 5;

# Extra headers to make docker registry work
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# Proxy to reg for the registry index
location / {
proxy_pass http://127.0.0.1:8080;
}

# Proxy to the docker registry API
location /v2/ {
proxy_pass http://127.0.0.1:5000;

# Disable proxy buffering so we don't block on disk i/o
proxy_buffering off;

# Enable large layers for Windows containers
client_max_body_size 15G;
}
}
```

Then start reg and the docker registry, e.g:

```
$ docker run -p :8080 r.j3ss.co/reg:v0.16.1 server -r https://docker.example.com --interval 10m
$ docker run -p :5000 registry:v2.7.1
```

## Contributing

If you plan on contributing you should be able to run the tests locally. The
Expand Down