Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
proxy_pass http://REGISTRY_PORT_5000_TCP_ADDR:REGISTRY_PORT_5000_TCP_PORT;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header Authorization "";
proxy_read_timeout 900;
# For going into conf.d/
server {
listen 80;
server_name whatever.example.com;
client_max_body_size 0;
chunked_transfer_encoding on;
location / {
auth_basic "Restricted";
auth_basic_user_file conf.d/htpasswd;
# https://github.com/docker/distribution/issues/397
add_header Docker-Distribution-Api-Version registry/2.0 always;
# We'll auto generate this file
include /docker-registry.conf;
}
}
#!/bin/sh
cp /etc/nginx/conf.d/docker-registry.tmpl /docker-registry.conf
[ -z "${REGISTRY_PORT_5000_TCP_ADDR}" ] && echo "\$REGISTRY_PORT_5000_TCP_ADDR is not set" || sed -i "s/REGISTRY_PORT_5000_TCP_ADDR/${REGISTRY_PORT_5000_TCP_ADDR}/" /docker-registry.conf
[ -z "${REGISTRY_PORT_5000_TCP_PORT}" ] && echo "\$REGISTRY_PORT_5000_TCP_PORT is not set" || sed -i "s/REGISTRY_PORT_5000_TCP_PORT/${REGISTRY_PORT_5000_TCP_PORT}/" /docker-registry.conf
/usr/sbin/nginx -g "daemon off;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.