Sign inSign up

crusherd/aws-ecr-proxy-rootless

By crusherd

Updated about 1 year ago

Simple openresty push/pull proxy for AWS ECR that supports rootless operation.

Image
Integration & delivery
Web servers
0

674

crusherd/aws-ecr-proxy-rootless repository overview

aws-ecr-proxy-rootless

https://github.com/CrusheRDevourer/aws-ecr-proxy-rootless

A very simple nginx push/pull proxy that forwards requests to AWS ECR and caches the responses locally. This is a fork of the original repository that aims to add a few features:

Configuration:

The proxy is packaged in a docker container and can be configured with following environment variables:

Environment VariableDescriptionStatusDefault
AWS_REGIONAWS Region for AWS ECRRequired
AWS_ACCESS_KEY_IDAWS Account Access Key IDOptional
AWS_SECRET_ACCESS_KEYAWS Account Secret Access KeyOptional
AWS_USE_EC2_ROLE_FOR_AUTHSet this to true if we do want to use aws roles for authentication instead of providing the secret and access keys explicitlyOptional
UPSTREAMURL for AWS ECRRequired
RESOLVERDNS server to be used by proxyRequired
PORTPort on which proxy listensRequired
CACHE_MAX_SIZEMaximum size for cache volumeOptional75g
CACHE_KEYCache key used for the content by nginxOptional$uri
ENABLE_SSLUsed to enable SSL/TLS for proxyOptionalfalse
REGISTRY_HTTP_TLS_KEYPath to TLS key in the containerRequired with TLS
REGISTRY_HTTP_TLS_CERTIFICATEPath to TLS cert in the containerRequired with TLS
Example:
docker run -d --name docker-registry-proxy --net=host \
  -v /registry/local-storage/cache:/cache \
  -v /registry/certificate.pem:/opt/ssl/certificate.pem \
  -v /registry/key.pem:/opt/ssl/key.pem \
  -e PORT=5005 \
  -e RESOLVER=8.8.8.8 \
  -e UPSTREAM=https://XXXXXXXXXX.dkr.ecr.eu-central-1.amazonaws.com \
  -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
  -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
  -e AWS_REGION=${AWS_DEFAULT_REGION} \
  -e CACHE_MAX_SIZE=100g \
  -e ENABLE_SSL=true \
  -e REGISTRY_HTTP_TLS_KEY=/opt/ssl/key.pem \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/opt/ssl/certificate.pem \
  crusherd/aws-ecr-proxy-rootless:latest

If you ran this command on "registry-proxy.example.com" you can now get your images using docker pull registry-proxy.example.com:5005/repo/image.

Deploying the proxy
Deploying on Kubernetes with Helm

You can install on Kubernetes using the community-maintained chart like this:

helm repo add evryfs-oss https://evryfs.github.io/helm-charts/
helm install evryfs-oss/ecr-proxy --name ecr-proxy --namespace ecr-proxy

See the values-file for configuration parameters.

Note on SSL/TLS

The proxy is using HTTP (plain text) as default protocol for now. So in order to avoid docker client complaining either:

  • (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.
  • Mark the registry host as insecure in your client deamon config.

Tag summary

Content type

Image

Digest

sha256:61f9e1d28

Size

356.7 MB

Last updated

about 1 year ago

docker pull crusherd/aws-ecr-proxy-rootless