Docker registry
docker run -d -p 5001:5000 --restart=always --name registry -v /data/registry:/var/lib/registry registry:2
$ cat registry.conf
upstream docker-registry {
server 172.16.149.242:5001;
}
server {
listen 80;
server_name registry.xxxxxxx.cn;
add_header 'Docker-Distribution-Api-Version' 'registry/2.0' always;
location / {
auth_basic "Please Input username/password";
auth_basic_user_file "/etc/nginx/conf.d/docker-registry-htpasswd";
proxy_pass http://docker-registry;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarder-Porto $scheme;
proxy_read_timeout 600;
client_max_body_size 0;
}
}
- docker-registry-htpasswd nginx认证
htpasswd -c /etc/nginx/conf.d/docker-registry-htpasswd $username
harbor