[英]Docker private registry with multiple registry urls using nginx
我目前有一些系統正在使用通過nginx的私有Docker注冊表,但是我想將注冊表更改為新位置(使用新的主機名)。
是否可以使用nginx將URL重寫/重定向到新注冊表。
例如
我有一個注冊表registry-old.domain.com
,還有一個新的registry-new.domain.com
。 我希望能夠繼續使用docker pull registry-old.domain.com
,但實際上要轉到新的注冊表registry-new.domain.com
。
由於您必須使用注冊表URL標記圖像,因此我不確定是否可以這樣做。
這是我當前的nginx配置:
# New config to cover old and new domain
# Works for new, but not for the old domain
server {
server_name registry-old.domain.com registry-new.domain.com;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Host registry-new.domain.com; # Also tried $host
proxy_set_header X-Real-IP $remote_addr;
}
}
# Original working registry
#server {
# server_name registry-old.domain.com;
#
# location / {
# proxy_pass http://oldRegistry:5000;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# }
#}
是的,您可以這樣做,但是如果您使用的是TLS,則必須具有通配符TLS證書,並以*.domain.com
作為公用名或在“主題備用名稱”中使用DNS:*.domain.com
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.