简体   繁体   English

Artifactory Docker注册表Docker映像

[英]Artifactory docker registry docker image

I am playing around with the 4.13 version of artifactory using the pro-registry docker image 我正在使用pro-registry docker image来玩4.13版本的工件

I created a virtual docker repo and a local docker repo as suggested in the doc and changed the nginx conf as follows 我按照文档中的建议创建了一个虚拟的docker repo和一个本地的docker repo,并如下更改了nginx conf

log into the running container 
sudo docker exec -i -t containerID# /bin/bash
vi /etc/nginx/conf.d/default.conf


ssl_certificate      /etc/nginx/ssl/demo.pem;
ssl_certificate_key  /etc/nginx/ssl/demo.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers   on;

server {
        listen 80;
        listen 443  ssl;
        client_max_body_size 2048M;
        location / {
                proxy_set_header Host $host;
                proxy_pass http://localhost:8081/artifactory/;
                proxy_read_timeout 90;
        }
        access_log /var/log/nginx/access.log upstreamlog;
        location /basic_status {
                stub_status on;
                allow all;
                }
}

## Sub domain config for docker repository
server {
  listen 443 ssl;
  listen 80 ;
  server_name my-docker-virtual.art.local art.local;

  if ($http_x_forwarded_proto = '') {
    set $http_x_forwarded_proto  $scheme;
  }
  ## Application specific logs
  access_log /var/log/nginx/docker-access.log;
  error_log /var/log/nginx/docker-error.log;
  rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/my-docker-virtual/$1/$2;
  client_max_body_size 0;
  chunked_transfer_encoding on;
  location /artifactory/ {
    proxy_read_timeout  900;
    proxy_pass_header   Server;
    proxy_cookie_path ~*^/.* /;
    proxy_pass         http://artifactory_lb/artifactory/
    proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
    proxy_set_header    X-Forwarded-Port  $server_port;
    proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header    Host              $http_host;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
  }
}

This works great I can do the following 这很棒,我可以执行以下操作

docker login my-docker-virtual.art.local
user
pass
email

docker push my-docker-virtual.art.local/busybox

docker pull busybox

However when I change the nginx o the following 但是,当我更改nginx o以下时

ssl_certificate      /etc/nginx/ssl/demo.pem;
ssl_certificate_key  /etc/nginx/ssl/demo.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers   on;

server {
        listen 80;
        listen 443  ssl;
        client_max_body_size 2048M;
        location / {
                proxy_set_header Host $host;
                proxy_pass http://localhost:8081/artifactory/;
                proxy_read_timeout 90;
        }
        access_log /var/log/nginx/access.log upstreamlog;
        location /basic_status {
                stub_status on;
                allow all;
                }
}

## Sub domain config for docker repository
server {
  listen 443 ssl;
  listen 80 ;
  server_name my-docker-virtual.art.local art.local;

  if ($http_x_forwarded_proto = '') {
    set $http_x_forwarded_proto  $scheme;
  }
  ## Application specific logs
  access_log /var/log/nginx/docker-access.log;
  error_log /var/log/nginx/docker-error.log;
  rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/wrong-docker-virtual/$1/$2;
  client_max_body_size 0;
  chunked_transfer_encoding on;
  location /artifactory/ {
    proxy_read_timeout  900;
    proxy_pass_header   Server;
    proxy_cookie_path ~*^/.* /;
    proxy_pass         http://localhost:8081/artifactory/
    proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
    proxy_set_header    X-Forwarded-Port  $server_port;
    proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header    Host              $http_host;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
  }
}

after this I reload the config 之后,我重新加载配置

Everything still works which it should not, the redirect should fail. 一切仍然可以正常进行,重定向应该失败。 Shouldnt it? 应该吗?

Note that I am using the self signed cert that comes with the docker image 请注意,我正在使用Docker映像随附的自签名证书

因此,我必须service nginx restart才能看到这些更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM