You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-20Lines changed: 18 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
-
## docker-registry-proxy
2
-
3
-
### TL,DR
1
+
## TL,DR
4
2
5
3
A caching proxy for Docker; allows centralised management of (multiple) registries and their authentication; caches images from *any* registry.
6
4
7
-
###What?
5
+
## What?
8
6
9
7
Essentially, it's a [man in the middle](https://en.wikipedia.org/wiki/Man-in-the-middle_attack): an intercepting proxy based on `nginx`, to which all docker traffic is directed using the `HTTPS_PROXY` mechanism and injected CA root certificates.
10
8
@@ -15,25 +13,25 @@ As a bonus it allows for centralized management of Docker registry credentials,
15
13
You configure the Docker clients (_err... Kubernetes Nodes?_) once, and then all configuration is done on the proxy --
16
14
for this to work it requires inserting a root CA certificate into system trusted root certs.
17
15
18
-
###master is unstable/beta
16
+
## master is unstable/beta
19
17
20
18
-`master` (and `:latest` Docker tag) is unstable
21
19
- Currently, stable version is `0.3.0`, see [0.3.0 tag on Github](https://github.com/rpardini/docker-registry-proxy/tree/0.3.0)
22
20
23
-
###Usage
21
+
## Usage
24
22
25
23
- Run the proxy on a host close (network-wise: high bandwidth, same-VPC, etc) to the Docker clients
26
24
- Expose port 3128 to the network
27
25
- Map volume `/docker_mirror_cache` for up to `CACHE_MAX_SIZE` (32gb by default) of cached images across all cached registries
28
26
- Map volume `/ca`, the proxy will store the CA certificate here across restarts. **Important** this is security sensitive.
29
27
- Env `CACHE_MAX_SIZE` (default `32g`): set the max size to be used for caching local Docker image layers. Use [Nginx sizes](http://nginx.org/en/docs/syntax.html).
30
-
- Env `REGISTRIES`: space separated list of registries to cache; no need to include Docker Hub, its already there.
28
+
- Env `REGISTRIES`: space separated list of registries to cache; no need to include DockerHub, its already done internally.
31
29
- Env `AUTH_REGISTRIES`: space separated list of `hostname:username:password` authentication info.
32
30
-`hostname`s listed here should be listed in the REGISTRIES environment as well, so they can be intercepted.
33
31
- Env `AUTH_REGISTRIES_DELIMITER` to change the separator between authentication info. By default, a space: "``". If you use keys that contain spaces (as with Google Cloud Registry), you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=";;;"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:user1:pass1;;;registry2.com:user2:pass2`.
34
32
- Env `AUTH_REGISTRY_DELIMITER` to change the separator between authentication info *parts*. By default, a colon: "`:`". If you use keys that contain single colons, you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=":::"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:::user1:::pass1 registry2.com:::user2:::pass2`.
###Configuring the Docker clients / Kubernetes nodes
101
+
## Configuring the Docker clients / Kubernetes nodes
104
102
105
103
Let's say you setup the proxy on host `192.168.66.72`, you can then `curl http://192.168.66.72:3128/ca.crt` and get the proxy CA certificate.
106
104
@@ -133,7 +131,7 @@ systemctl daemon-reload
133
131
systemctl restart docker.service
134
132
```
135
133
136
-
###Testing
134
+
## Testing
137
135
138
136
Clear `dockerd` of everything not currently running: `docker system prune -a -f`*beware*
139
137
@@ -145,7 +143,7 @@ Do the same for `docker pull ubuntu` and rejoice.
145
143
146
144
Test your own registry caching and authentication the same way; you don't need `docker login`, or `.docker/config.json` anymore.
147
145
148
-
###Gotchas
146
+
## Gotchas
149
147
150
148
- If you authenticate to a private registry and pull through the proxy, those images will be served to any client that can reach the proxy, even without authentication. *beware*
151
149
- Repeat, **this will make your private images very public if you're not careful**.
@@ -154,7 +152,7 @@ Test your own registry caching and authentication the same way; you don't need `
154
152
- On Mac and Windows the CA-certificate part will be very different but should work in principle.
155
153
- Please send PRs with instructions for Windows and Mac if you succeed!
156
154
157
-
####Why not use Docker's own registry, which has a mirror feature?
155
+
### Why not use Docker's own registry, which has a mirror feature?
158
156
159
157
Yes, Docker offers [Registry as a pull through cache](https://docs.docker.com/registry/recipes/mirror/), *unfortunately*
160
158
it only covers the DockerHub case. It won't cache images from `quay.io`, `k8s.gcr.io`, `gcr.io`, or any such, including any private registries.
@@ -167,14 +165,14 @@ with no repository reference (eg, from DockerHub).
167
165
When a repository is specified `dockerd` goes directly there, via HTTPS (and also via HTTP if included in a
168
166
`--insecure-registry` list), thus completely ignoring the configured mirror.
169
167
170
-
####Docker itself should provide this.
168
+
### Docker itself should provide this.
171
169
172
170
Yeah. Docker Inc should do it. So should NPM, Inc. Wonder why they don't. 😼
173
171
174
172
### TODO:
175
173
176
-
- Allow using multiple credentials for DockerHub; this is possible since the `/token` request includes the wanted repo as a query string parameter.
177
-
- Test and make auth work with quay.io, unfortunately I don't have access to it (_hint, hint, quay_)
178
-
- Hide the mitmproxy building code under a Docker build ARG.[DONE]
179
-
-I hope that in the future this can also be used as a "Developer Office" proxy, where many developers on a fast local network
174
+
-[ ]Allow using multiple credentials for DockerHub; this is possible since the `/token` request includes the wanted repo as a query string parameter.
175
+
-[ ]Test and make auth work with quay.io, unfortunately I don't have access to it (_hint, hint, quay_)
176
+
-[x]Hide the mitmproxy building code under a Docker build ARG.
177
+
-[ ] hope that in the future this can also be used as a "Developer Office" proxy, where many developers on a fast local network
180
178
share a proxy for bandwidth and speed savings; work is ongoing in this direction.
0 commit comments