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

Commit 505f8dd

Browse files
author
Olivier Gambier
committed
Enhance documentation
Docker-DCO-1.1-Signed-off-by: Olivier Gambier <[email protected]> (github: dmp42)
1 parent 56b6990 commit 505f8dd

File tree

3 files changed

+295
-224
lines changed

3 files changed

+295
-224
lines changed

ADVANCED.md

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

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)