Skip to content

Commit 6b4a26e

Browse files
committed
README: reword, one less header level
1 parent f225468 commit 6b4a26e

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

README.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
## docker-registry-proxy
2-
3-
### TL,DR
1+
## TL,DR
42

53
A caching proxy for Docker; allows centralised management of (multiple) registries and their authentication; caches images from *any* registry.
64

7-
### What?
5+
## What?
86

97
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.
108

@@ -15,25 +13,25 @@ As a bonus it allows for centralized management of Docker registry credentials,
1513
You configure the Docker clients (_err... Kubernetes Nodes?_) once, and then all configuration is done on the proxy --
1614
for this to work it requires inserting a root CA certificate into system trusted root certs.
1715

18-
### master is unstable/beta
16+
## master is unstable/beta
1917

2018
- `master` (and `:latest` Docker tag) is unstable
2119
- 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)
2220

23-
### Usage
21+
## Usage
2422

2523
- Run the proxy on a host close (network-wise: high bandwidth, same-VPC, etc) to the Docker clients
2624
- Expose port 3128 to the network
2725
- Map volume `/docker_mirror_cache` for up to `CACHE_MAX_SIZE` (32gb by default) of cached images across all cached registries
2826
- Map volume `/ca`, the proxy will store the CA certificate here across restarts. **Important** this is security sensitive.
2927
- 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.
3129
- Env `AUTH_REGISTRIES`: space separated list of `hostname:username:password` authentication info.
3230
- `hostname`s listed here should be listed in the REGISTRIES environment as well, so they can be intercepted.
3331
- 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`.
3432
- 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`.
3533

36-
#### DockerHub specifics
34+
### DockerHub
3735

3836
For Docker Hub authentication:
3937
- `hostname` should be `auth.docker.io`
@@ -49,15 +47,15 @@ docker run --rm --name docker_registry_proxy -it \
4947
rpardini/docker-registry-proxy:0.3.0
5048
```
5149

52-
#### Simple registries (HTTP Basic auth)
50+
### Simple registries (HTTP Basic auth)
5351

5452
For regular registry auth (HTTP Basic), the `hostname` should be the registry itself... unless your registry uses a different auth server.
5553

5654
See the example above for DockerHub, adapt the `your.own.registry` parts (in both ENVs).
5755

5856
This should work for quay.io also, but I have no way to test.
5957

60-
#### GitLab specifics
58+
### GitLab
6159

6260
GitLab may use a different/separate domain to handle the authentication procedure.
6361

@@ -77,7 +75,7 @@ docker run --rm --name docker_registry_proxy -it \
7775
rpardini/docker-registry-proxy:0.3.0
7876
```
7977

80-
#### Google Container Registry (GCR) specifics
78+
### Google Container Registry (GCR)
8179

8280
For Google Container Registry (GCR), username should be `_json_key` and the password should be the contents of the service account JSON.
8381
Check out [GCR docs](https://cloud.google.com/container-registry/docs/advanced-authentication#json_key_file).
@@ -100,7 +98,7 @@ docker run --rm --name docker_registry_proxy -it \
10098
rpardini/docker-registry-proxy:0.3.0
10199
```
102100

103-
### Configuring the Docker clients / Kubernetes nodes
101+
## Configuring the Docker clients / Kubernetes nodes
104102

105103
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.
106104

@@ -133,7 +131,7 @@ systemctl daemon-reload
133131
systemctl restart docker.service
134132
```
135133

136-
### Testing
134+
## Testing
137135

138136
Clear `dockerd` of everything not currently running: `docker system prune -a -f` *beware*
139137

@@ -145,7 +143,7 @@ Do the same for `docker pull ubuntu` and rejoice.
145143

146144
Test your own registry caching and authentication the same way; you don't need `docker login`, or `.docker/config.json` anymore.
147145

148-
### Gotchas
146+
## Gotchas
149147

150148
- 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*
151149
- 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 `
154152
- On Mac and Windows the CA-certificate part will be very different but should work in principle.
155153
- Please send PRs with instructions for Windows and Mac if you succeed!
156154

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?
158156

159157
Yes, Docker offers [Registry as a pull through cache](https://docs.docker.com/registry/recipes/mirror/), *unfortunately*
160158
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).
167165
When a repository is specified `dockerd` goes directly there, via HTTPS (and also via HTTP if included in a
168166
`--insecure-registry` list), thus completely ignoring the configured mirror.
169167

170-
#### Docker itself should provide this.
168+
### Docker itself should provide this.
171169

172170
Yeah. Docker Inc should do it. So should NPM, Inc. Wonder why they don't. 😼
173171

174172
### TODO:
175173

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
180178
share a proxy for bandwidth and speed savings; work is ongoing in this direction.

0 commit comments

Comments
 (0)