Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 5a92101

Browse files
committed
Merge pull request #563 from docker/next
Next
2 parents 3753407 + 70d7bc0 commit 5a92101

29 files changed

+447
-433
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*.db
66
.DS_Store
77
.idea
8-
.dotcloud
98
.coverage
109
.tox
1110
htmlcov

ADVANCED.md

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
# Docker-Registry advanced use
2+
3+
4+
5+
## "extras"
6+
7+
The registry support additional features (that require additional dependencies) that you may require at install time.
8+
9+
### Installation
10+
11+
If you are using the official registry container, you don't need to do anything, as all extras are installed by default.
12+
13+
If you are using pip, you have to explicitely request the extra you want, using pip extra syntax:
14+
15+
`pip install docker-registry[someextra]`
16+
17+
You can request several different extras at the same time by specifying a coma separated list, eg:
18+
19+
`pip install docker-registry[someextra,anotherextra]`
20+
21+
### Available "extras"
22+
23+
#### "bugsnag"
24+
25+
This enables [bugsnag](https://bugsnag.com) reporter in your registry.
26+
27+
1. `bugsnag`: your bugsnag API key
28+
29+
Note the bugsnag "stage" will be set to the specified configuration "flavor".
30+
31+
#### "newrelic"
32+
33+
This encapsulate your registry inside the new-relic agent.
34+
35+
You need to write a new-relic ini file, then use the following environment variables:
36+
37+
* `NEW_RELIC_INI` to point to your ini file
38+
* `NEW_RELIC_STAGE` to specify what stage you want
39+
40+
#### "cors"
41+
42+
To enable [CORS support](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) on your registry, you need to specify at least the `cors.origins` key in your config.
43+
44+
The complete list of what you can configure is as follow:
45+
46+
```
47+
cors:
48+
origins: _env:CORS_ORIGINS
49+
methods: _env:CORS_METHODS
50+
headers: _env:CORS_HEADERS:[Content-Type]
51+
expose_headers: _env:CORS_EXPOSE_HEADERS
52+
supports_credentials: _env:CORS_SUPPORTS_CREDENTIALS
53+
max_age: _env:CORS_MAX_AGE
54+
send_wildcard: _env:CORS_SEND_WILDCARD
55+
always_send: _env:CORS_ALWAYS_SEND
56+
automatic_options: _env:CORS_AUTOMATIC_OPTIONS
57+
vary_header: _env:CORS_VARY_HEADER
58+
resources: _env:CORS_RESOURCES
59+
```
60+
61+
Note that:
62+
63+
* the official, docker-operated registry doesn't enable CORS
64+
* if you enable CORS, it will be available on *all* endpoints
65+
* you should be careful with CORS as it presents numerous security pitfalls for you and your users in case of misuse/misconfiguration
66+
67+
## Proxying
68+
69+
The recommended setting to run the Registry in a production environment is the official container
70+
behind a nginx server which supports chunked transfer-encoding (nginx >= 1.3.9).
71+
72+
This is especially useful if you want to run standalone and implement your own authentication mechanism.
73+
74+
### nginx
75+
76+
[Here is an nginx configuration file example.](https://github.com/docker/docker-registry/blob/master/contrib/nginx/nginx.conf), which applies to versions < 1.3.9 which are compiled with the [HttpChunkinModule](http://wiki.nginx.org/HttpChunkinModule).
77+
78+
[This is another example nginx configuration file](https://github.com/docker/docker-registry/blob/master/contrib/nginx/nginx_1-3-9.conf) that applies to versions of nginx greater than 1.3.9 that have support for the chunked_transfer_encoding directive.
79+
80+
And you might want to add
81+
[Basic auth on Nginx](http://wiki.nginx.org/HttpAuthBasicModule) to protect it
82+
(if you're not using it on your local network):
83+
84+
85+
### Apache
86+
87+
Enable mod_proxy using `a2enmod proxy_http`, then use this snippet forward
88+
requests to the Docker Registry:
89+
90+
```
91+
ProxyPreserveHost On
92+
ProxyRequests Off
93+
ProxyPass / http://localhost:5000/
94+
ProxyPassReverse / http://localhost:5000/
95+
```
96+
97+
98+
## Alternative uses
99+
100+
If you don't want to run the registry inside a docker container, you may do so by running it directly, as follow:
101+
102+
103+
### Ubuntu
104+
105+
Install the system requirements:
106+
107+
```
108+
sudo apt-get install python-dev libevent-dev python-pip liblzma-dev
109+
```
110+
111+
Then install the Registry app:
112+
113+
```
114+
sudo pip install docker-registry
115+
```
116+
117+
If you need extra requirements (see above), specify them:
118+
119+
```
120+
sudo pip install docker-registry[bugsnag,newrelic,cors]
121+
```
122+
123+
Alternatively, you may clone the github repository and run `pip install .`
124+
125+
### Red Hat-based systems:
126+
127+
Install the required dependencies:
128+
129+
```
130+
sudo yum install python-devel libevent-devel python-pip gcc xz-devel
131+
```
132+
133+
NOTE: On RHEL and CentOS you will need the
134+
[EPEL](http://fedoraproject.org/wiki/EPEL) repostitories enabled. Fedora
135+
should not require the additional repositories.
136+
137+
Then install the Registry app:
138+
139+
```
140+
sudo python-pip install docker-registry[bugsnag,newrelic,cors]
141+
```
142+
143+
Alternatively, you may clone the github repository and run `pip install .`
144+
145+
### Run it
146+
147+
```
148+
docker-registry
149+
```
150+
151+
152+
### Advanced start options (NOT recommended)
153+
154+
If you want greater control over gunicorn:
155+
156+
```
157+
gunicorn -c contrib/gunicorn_config.py docker_registry.wsgi:application
158+
```
159+
160+
or even bare
161+
162+
```
163+
gunicorn --access-logfile - --error-logfile - -k gevent -b 0.0.0.0:5000 -w 4 --max-requests 100 docker_registry.wsgi:application
164+
```
165+
166+
## *non*-Amazon S3-compliant object stores (e.g. Ceph and Riak CS)
167+
168+
Example:
169+
170+
```
171+
docker run \
172+
-e SETTINGS_FLAVOR=s3 \
173+
-e AWS_BUCKET=mybucket \
174+
-e STORAGE_PATH=/registry \
175+
-e AWS_KEY=myawskey \
176+
-e AWS_SECRET=myawssecret \
177+
-e SEARCH_BACKEND=sqlalchemy \
178+
-p 5000:5000 \
179+
-p AWS_HOST=myowns3.com \
180+
-p AWS_SECURE=false \
181+
-p AWS_ENCRYPT=false \
182+
-p AWS_PORT=80 \
183+
-p AWS_DEBUG=true \
184+
-p AWS_CALLING_FORMAT=OrdinaryCallingFormat \
185+
registry
186+
```
187+
188+
189+
## Advanced configuration options
190+
191+
### Priviledged access
192+
193+
It's possible to allow priviledge access to your registry using an rsa key (useful for administration scripts for example).
194+
195+
To do so, specify in your config:
196+
197+
1. `privileged_key`: allows you to make direct requests to the registry by using
198+
an RSA key pair. The value is the path to a file containing the public key.
199+
If it is not set, privileged access is disabled.
200+
201+
To generate said key using `openssl`, you will need to install the python-rsa package (`pip install rsa`) in addition to using `openssl`.
202+
Generating the public key using openssl will lead to producing a key in a format not supported by
203+
the RSA library the registry is using.
204+
205+
Generate private key:
206+
207+
openssl genrsa -out private.pem 2048
208+
209+
Associated public key :
210+
211+
pyrsa-priv2pub -i private.pem -o public.pem
212+
213+
214+
### Email exceptions
215+
216+
Settings these options makes the Registry send an email on each code Exception:
217+
218+
1. `email_exceptions`:
219+
1. `smtp_host`: hostname to connect to using SMTP
220+
1. `smtp_port`: port number to connect to using SMTP
221+
1. `smtp_login`: username to use when connecting to authenticated SMTP
222+
1. `smtp_password`: password to use when connecting to authenticated SMTP
223+
1. `smtp_secure`: boolean, true for TLS to using SMTP. this could be a path
224+
to the TLS key file for client authentication.
225+
1. `from_addr`: email address to use when sending email
226+
1. `to_addr`: email address to send exceptions to
227+
228+
Example:
229+
230+
```yaml
231+
test:
232+
email_exceptions:
233+
smtp_host: localhost
234+
```
235+

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
* enhanced style checking
88
* enhanced testing
99
* uniformized various gunicorn start stances
10+
* enhanced/cleaned-up debugging
11+
* removed unused endpoints and code
12+
* improved documentation
13+
* more complete CORS support (as en extra)
1014

15+
## 0.8.1
16+
17+
* security fixes (path traversing prevention and token validation)
1118

1219
## 0.8.0
1320

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add ./config/boto.cfg /etc/boto.cfg
2525
run pip install /docker-registry/depends/docker-registry-core
2626

2727
# Install registry
28-
run pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic]
28+
run pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
2929

3030
env DOCKER_REGISTRY_CONFIG /docker-registry/config/config_sample.yml
3131
env SETTINGS_FLAVOR dev

FAQ.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# FAQ
2+
3+
## The container doesn't start!
4+
5+
Verify that the port is not already used (typically, by another container). You may do so by running `docker ps | grep PORTNUMBER`
6+
7+
## How do I setup user accounts?
8+
9+
The standalone registry does not provide account management. For simple
10+
access control, you can set up an nginx or Apache frontend with basic
11+
auth enabled (see the (advanced documentation)[ADVANCED.md] for more about that).
12+
13+
14+
## How do I report a bug?
15+
16+
Please insert the following into your bug report:
17+
18+
* your registry version
19+
* specify how you are using your registry (container or pip)
20+
* specify what storage backend you use
21+
* restart your registry with the `DEBUG=true` environment variable set, and copy the output of `curl https://myregistry/_ping`
22+
* possibly copy any stack trace that you have
23+
24+
Please, no "this happens to me as well" comments on tickets - not helpful.
25+
26+
On the other hand, if you do have any useful information to provide, by all means do.

0 commit comments

Comments
 (0)