https://pan.baidu.com/s/19-gntfgbQZLjoJMajMG3BQ m5cchtml
解壓nginx
tar zxf harbor-online-installer-v1.2.0.tgz -C /usr/local/ cd /usr/local/harbor
修改配置git
vim harbor.cfg
hostname = abc.com email_server = smtp.qq.com email_server_port = 25 email_username = abc@abc.com email_password =1234567 email_from = abc <abc@abc.com> email_ssl = false harbor_admin_password = admin db_password = admin clair_db_password = admin self_registration = off project_creation_restriction = adminonly
vim docker-compose.yml
registry: image: vmware/registry-photon:v2.6.2-v1.5.2 container_name: registry restart: always volumes: - /data/registry:/storage:z - ./common/config/registry/:/etc/registry/:z networks: - harbor environment: - GODEBUG=netdns=cgo ports: - 5000:5000 proxy: image: vmware/nginx-photon:v1.5.2 container_name: nginx restart: always volumes: - ./common/config/nginx:/etc/nginx:z networks: - harbor ports: - 8080:80 - 1443:443 - 14443:4443
server { server_name abc.com; listen 443 ssl; client_max_body_size 1000m; ssl_certificate ./cert/abc.pem; ssl_certificate_key ./cert/abc.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location /v2/ { proxy_pass http://127.0.0.1:5000/v2/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_request_buffering off; } location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } server { listen 80; server_name abc.com; client_max_body_size 1000m; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
https://abc.com admin/admingithub
docker login abc.com
docker tag busybox abc.com/library/busybox:admin docker push abc.com/library/busybox:admin docker pull abc.com/library/busybox:admin
內網訪問docker
建立/etc/docker/daemon.jsonjson
{ "registry-mirrors": [ "https://registry.docker-cn.com" ], "insecure-registries":["192.168.1.2:8080"] }
service docker restart
docker login 192.168.1.2:8080
docker tag busybox 192.168.1.2:8080/library/busybox:admin docker push 192.168.1.2:8080/library/busybox:admin docker pull 192.168.1.2:8080/library/busybox:admin
Authenticating with existing credentials... Login did not succeed, error: Error response from daemon: Get https://docker.daoxuehao.com/v2/: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor="white">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>ngvim
添加 80:端口ui
location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
出現 HTTP 405rest
https://github.com/goharbor/harbor/issues/37code
location /v2/ { proxy_pass http://192.168.xxx.xxxx:5000/v2/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_request_buffering off;
} expose port 5000 in harbor Deploy docker-compose.yml
出現 HTTP 413
error parsing HTTP 413 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>413 Request Entity Too Large</title></head>\r\n<body bgcolor="white">\r\n<center><h1>413 Request Entity Too Large</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
server { ... client_max_body_size 20m; ... }