Skip to content

Commit 4e3b6b8

Browse files
committed
Update README.md
1 parent 14a90de commit 4e3b6b8

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

README.md

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
1-
aws-ecr-http-proxy
2-
===========
3-
4-
A very simple nginx proxy that forwards requests to AWS ECR and caches the responses locally.
5-
6-
Run it like this, replace UPSTREAM with your target address with following required params:
7-
- `AWS_REGION`
8-
- `AWS_ACCESS_KEY_ID`
9-
- `AWS_SECRET_ACCESS_KEY`
10-
11-
It is also possible to define `CACHE_MAX_SIZE` env to limit maximum cache size on provided volume
12-
13-
For example:
1+
<p align="left">
2+
<a href="https://hub.docker.com/r/esailors/aws-ecr-http-proxy/builds" alt="Build">
3+
<img src="https://img.shields.io/docker/build/esailors/aws-ecr-http-proxy" /></a>
4+
<a href="https://hub.docker.com/r/esailors/aws-ecr-http-proxy" alt="Pulls">
5+
<img src="https://img.shields.io/docker/pulls/esailors/aws-ecr-http-proxy" /></a>
6+
<a href="https://www.esailors.de" alt="Maintained">
7+
<img src="https://img.shields.io/maintenance/yes/2019.svg" /></a>
8+
9+
</p>
10+
11+
# aws-ecr-http-proxy
12+
13+
A very simple nginx push/pull proxy that forwards requests to AWS ECR and caches the responses locally.
14+
15+
### Configuration:
16+
The proxy is packaged in a docker container and can be configured with following environment variables:
17+
18+
| Environment Variable | Description | Status | Default |
19+
| :---------------------------------: | :--------------------------------------------: | :-------------------------------: | :--------: |
20+
| `AWS_REGION` | AWS Region for AWS ECR | Required | |
21+
| `AWS_ACCESS_KEY_ID` | AWS Account Access ID | Required | |
22+
| `AWS_SECRET_ACCESS_KEY` | AWS Account Secret Key | Required | |
23+
| `RESOLVER` | DNS server to used by proxy | Required | |
24+
| `PORT` | Port on which proxy listens | Required | |
25+
| `CACHE_MAX_SIZE` | Maximum size for cache volume | Optional | `75g` |
26+
| `CACHE_KEY` | Key to be used for images content/blobs | Optional | `$uri` |
27+
| `ENABLE_SSL` | Used to enable SSL/TLS for proxy | Optional | `false` |
28+
| `REGISTRY_HTTP_TLS_KEY` | Path to TLS key in the container | Required with TLS | |
29+
| `REGISTRY_HTTP_TLS_CERTIFICATE` | Path to TLS cert in the container | Required with TLS | |
30+
31+
### Example:
1432

1533
```sh
1634
docker run --rm --name docker-registry-proxy --net=host \
17-
-v /local-storage/cache:/cache \
35+
-v /registry/local-storage/cache:/cache \
36+
-v /registry/certificate.pem:/opt/ssl/certificate.pem
37+
-v /registry/key.pem:/opt/ssl/key.pem
1838
-e PORT=5000 \
1939
-e RESOLVER=8.8.8.8 \
2040
-e UPSTREAM=https://XXXXXXXXXX.dkr.ecr.eu-central-1.amazonaws.com \
2141
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
2242
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
2343
-e AWS_REGION=${AWS_DEFAULT_REGION} \
2444
-e CACHE_MAX_SIZE=100g \
45+
-e ENABLE_SSL=true \
46+
-e REGISTRY_HTTP_TLS_KEY=/opt/ssl/key.pem \
47+
-e REGISTRY_HTTP_TLS_CERTIFICATE=/opt/ssl/certificate.pem
2548
esailors/aws-ecr-http-proxy:latest
2649
```
2750

@@ -32,7 +55,9 @@ Modify the ansible role variables according to your need and run the playbook as
3255
```sh
3356
ansible-playbook -i hosts playbook-docker-registry-proxy.yaml
3457
```
35-
The docker registry for project is available [here](https://hub.docker.com/r/esailors/aws-ecr-http-proxy)
58+
In case you want to enable SSL/TLS please replace the SSL certificates with the valid ones in `roles/docker-registry-proxy/files/*.pem`
3659

37-
### Note
38-
The proxy has `HTTP` endpoint so in order to avoid docker client complaining about it either mark the registry host as insecure in your [deamon config](https://docs.docker.com/registry/insecure/) or add [SSL/TLS termination](https://docs.docker.com/registry/recipes/nginx)
60+
### Note on SSL/TLS
61+
The proxy is using `HTTP` (plain text) as default protocol for now. So in order to avoid docker client complaining either:
62+
- (**Recommended**) Enable SSL/TLS using `ENABLE_SSL` configuration. For that you will have to mount your **valid** certificate/key in the container and pass the paths using `REGISTRY_HTTP_TLS_*` variables.
63+
- Mark the registry host as insecure in your [deamon config](https://docs.docker.com/registry/insecure/).

files/startup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ echo Using resolver $RESOLVER and $UPSTREAM [$(dig +short ${UPSTREAM_WITHOUT_PO
3434
CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-75g}
3535
echo Using cache max size $CACHE_MAX_SIZE
3636

37-
CACHE_KEY=${CACHE_KEY:='$scheme$uri$request_method'}
37+
CACHE_KEY=${CACHE_KEY:='$uri'}
3838
echo Using cache key $CACHE_KEY
3939

4040
SCHEME=http

0 commit comments

Comments
 (0)