Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ with region as environment variable and credentials from IAM role
```
docker run -e REGION='YOUR_AWS_REGION' -d catalinpan/aws-ecr-proxy
```
when running in a private VPC
```
docker run -e DNS_RESOLVERS=169.254.169.253 -d catalinpan/aws-ecr-proxy
```

## SSL
The certificates included are just to get nginx started. Generate your own certificate, get valid ssl certificates or use the container behind a load balancer with valid SSL certificates.
Expand Down
7 changes: 7 additions & 0 deletions configs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ nx_conf=/etc/nginx/nginx.conf

AWS_IAM='http://169.254.169.254/latest/dynamic/instance-identity/document'
AWS_FOLDER='/root/.aws'
DEFAULT_RESOLVERS='8.8.8.8 8.8.4.4'

header_config() {
mkdir -p ${AWS_FOLDER}
Expand Down Expand Up @@ -70,6 +71,11 @@ else
fi
fi

if [ "$DNS_RESOLVERS" = "" ]
then
DNS_RESOLVERS=$DEFAULT_RESOLVERS
fi

# update the auth token
if [ "$REGISTRY_ID" = "" ]
then
Expand All @@ -84,6 +90,7 @@ reg_url=$(echo "${aws_cli_exec}" | awk '{print $7}')

sed -i "s|${auth%??}|${auth_n}|g" ${nx_conf}
sed -i "s|REGISTRY_URL|$reg_url|g" ${nx_conf}
sed -i "s|DNS_RESOLVERS|$DNS_RESOLVERS|g" ${nx_conf}

/renew_token.sh &

Expand Down
2 changes: 1 addition & 1 deletion configs/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ events {
}

http {
resolver 8.8.8.8 8.8.4.4;
resolver DNS_RESOLVERS;

server {

Expand Down