标签:域名 特性 文件复制 x509 官方 日志收集 protocol sys login
1 root@docker01:~# wget https://github.com/mkuchin/docker-registry-web/releases/download/v0.1.2/examples.tar.gz 2 root@docker01:~# tar -zxvf examples.tar.gz 3 root@docker01:~# mv examples compose_registry
1 root@docker01:~# mkdir -p /registry/db 2 root@docker01:~# mkdir -p /registry/images 3 root@docker01:~# cd compose_registry/auth-disabled/ 4 root@docker01:~/compose_registry/auth-disabled# vi conf/registry/config.yml 5 version: 0.1 6 storage: 7 filesystem: 8 rootdirectory: /registry #指定registry工作目录 9 delete: 10 enabled: true #开启删除功能 11 http: 12 addr: 0.0.0.0:5000 13 notifications: 14 endpoints: 15 - name: listener 16 url: http://registry-web:8080/api/notification 17 timeout: 500ms 18 threshold: 5 19 backoff: 1s 20 root@docker01:~/compose_registry/auth-disabled# vi conf/registry-web/config.yml 21 registry: 22 url: http://registry:5000/v2 23 name: 172.24.8.111:5000 24 readonly: false 25 auth: 26 enabled: false #关闭相关认证 27 root@docker01:~/compose_registry/auth-disabled# vi docker-compose.yml 28 version: ‘2‘ 29 services: 30 registry-web: 31 image: hyper/docker-registry-web:latest 32 ports: 33 - 8080:8080 34 volumes: 35 - ./conf/registry-web:/conf:ro 36 - /registry/db:/data #修改db保存目录 37 networks: 38 - registry-net 39 depends_on: 40 - registry 41 registry: 42 image: registry:2.4.1 43 ports: 44 - 5000:5000 45 volumes: 46 - /registry/images:/registry #修改镜像保存路径 47 - ./conf/registry:/etc/docker/registry:ro 48 networks: 49 - registry-net 50 networks: 51 registry-net: 52 # driver: default
1 root@docker01:~/compose_registry/auth-disabled# docker-compose up -d
1 root@docker02:~# vi /etc/docker/daemon.json 2 { 3 "insecure-registries": ["172.24.8.111:5000"] 4 } 5 root@docker02:~# docker pull hello-world #pull测试镜像 6 root@docker02:~# docker tag hello-world:latest 172.24.8.111:5000/registry/hello-world:xhy #修改对应的tag 7 root@docker02:~# docker push 172.24.8.111:5000/registry/hello-world
1 root@docker01:~# mkdir -p /registry/db 2 root@docker01:~# mkdir -p /registry/images 3 root@docker01:~# cd compose_registry/auth-enabled/ 4 root@docker01:~/compose_registry/auth-enabled# vi conf/registry/config.yml 5 version: 0.1 6 storage: 7 filesystem: 8 rootdirectory: /registry 9 delete: 10 enabled: true #开启删除功能 11 http: 12 addr: 0.0.0.0:5000 13 auth: 14 token: 15 realm: http://172.24.8.111:8080/api/auth 16 service: 172.24.8.111:5000 17 issuer: test 18 rootcertbundle: /etc/docker/registry/auth.cert #配置cert路径 19 log: 20 level: info 21 22 notifications: 23 endpoints: 24 - name: listener 25 url: http://registry-web:8080/api/notification 26 timeout: 500ms 27 threshold: 5 28 backoff: 1s 29 root@docker01:~/compose_registry/auth-disabled# vi conf/registry-web/config.yml 30 registry: 31 url: http://registry:5000/v2 32 name: 172.24.8.111:5000 33 readonly: false 34 auth: 35 enabled: true 36 key: /conf/auth.key #指定key的路径 37 issuer: test 38 root@docker01:~/compose_registry/auth-disabled# vi docker-compose.yml 39 version: ‘2‘ 40 services: 41 registry-web: 42 image: hyper/docker-registry-web:latest 43 ports: 44 - 8080:8080 45 volumes: 46 - ./conf/registry-web:/conf:ro 47 - /registry/db:/data 48 networks: 49 - registry-net 50 depends_on: 51 - registry 52 registry: 53 image: registry:2.4.1 54 ports: 55 - 5000:5000 56 volumes: 57 - ./conf/registry:/etc/docker/registry:ro 58 - /registry/images:/registry 59 networks: 60 - registry-net 61 networks: 62 registry-net: 63 # driver: default
1 root@docker01:~/compose_registry/nginx-auth-enabled# ./generate-keys.sh
1 root@docker01:~/compose_registry/nginx-auth-enabled# docker-compose up -d
1 root@docker02:~# vi /etc/docker/daemon.json 2 { 3 "insecure-registries": ["172.24.8.111:5000"] 4 } 5 root@docker02:~# docker pull hello-world #pull测试镜像 6 root@docker02:~# docker tag hello-world:latest 172.24.8.111:5000/registry/hello-world:xhy #修改对应的tag
1 root@docker02:~# docker login 172.24.8.111:5000 #输入默认admin/admin登录 2 root@docker02:~# docker push 172.24.8.111:5000/registry/hello-world
1 root@docker01:~# wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.4.tgz 2 root@docker01:~# tar xvf harbor-offline-installer-v1.5.4.tgz
1 root@docker01:~# mkdir /data #harbor默认相关volume挂载目录 2 root@docker01:~# cd harbor/ 3 root@docker01:~/harbor# vi harbor.cfg 4 hostname = reg.itzgr.com # harbor的访问地址
1 root@docker01:~/harbor# ./install.sh
1 empty_subj = "/C=/ST=/L=/O=/CN=/"
1 empty_subj = "/C=US/ST=California/L=Palo Alto/O=VMware, Inc./OU=Harbor/CN=notarysigner"
1 root@docker01:~# cd harbor 2 root@docker01:~/harbor# docker-compose ps
1 172.24.8.111 reg.itzgr.com
1 root@docker01:~# localdomain=reg.itzgr.com 2 root@docker01:~# openssl req 3 -newkey rsa:4096 -nodes -sha256 -keyout ca.key 4 -x509 -days 365 -out ca.crt #创建CA证书 5 Country Name (2 letter code) [AU]:CN #国家 6 State or Province Name (full name) [Some-State]:ZheJiang #州或省 7 Locality Name (eg, city) []:WenZhou #城市 8 Organization Name (eg, company) [Internet Widgits Pty Ltd]:harbor #机构 9 Organizational Unit Name (eg, section) []:harbor #组织 10 Common Name (e.g. server FQDN or YOUR name) []:reg.itzgr.com #访问域名 11 Email Address []:xhy@itzgr.com #邮箱 12 13 root@docker01:~# openssl req 14 -newkey rsa:4096 -nodes -sha256 -keyout $localdomain.key 15 -out $localdomain.csr #生成证书签名请求 16 Country Name (2 letter code) [AU]:CN 17 State or Province Name (full name) [Some-State]:ZheJiang 18 Locality Name (eg, city) []:WenZhou 19 Organization Name (eg, company) [Internet Widgits Pty Ltd]:harbor 20 Organizational Unit Name (eg, section) []:harbor 21 Common Name (e.g. server FQDN or YOUR name) []:reg.itzgr.com 22 Email Address []:xhy@itzgr.com 23 A challenge password []:x7374521* 24 An optional company name []:reg.itzgr.com 25 26 root@docker01:~# openssl x509 -req -days 365 -in $localdomain.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out $localdomain.crt 27 root@docker01:~# mkdir /root/cert/ 28 root@docker01:~# cp $localdomain.crt $localdomain.key /root/cert/
1 root@docker01:~# cd harbor/ 2 root@docker01:~/harbor# vi harbor.cfg 3 hostname = reg.itzgr.com 4 ui_url_protocol = https 5 ssl_cert = /root/cert/reg.itzgr.com.crt 6 ssl_cert_key = /root/cert/reg.itzgr.com.key
1 root@docker01:~/harbor# ./prepare 2 root@docker01:~/harbor# ./install.sh
1 empty_subj = "/C=/ST=/L=/O=/CN=/"
1 empty_subj = "/C=US/ST=California/L=Palo Alto/O=VMware, Inc./OU=Harbor/CN=notarysigner"
1 root@docker01:~# cd harbor 2 root@docker01:~/harbor# docker-compose ps
1 172.24.8.111 reg.itzgr.com
1 root@docker02:~# vi /etc/hosts 2 172.24.8.111 reg.itzgr.com 3 root@docker02:~# mkdir -p /etc/docker/certs.d/reg.itzgr.com 4 root@docker01:~# scp ca.crt root@172.24.8.112:/etc/docker/certs.d/reg.itzgr.com/
1 root@docker02:~# vi /etc/docker/daemon.json 2 { 3 "insecure-registries": ["https://reg.itzgr.com"] 4 }
1 root@docker02:~# docker login reg.itzgr.com #登录registry 2 Username: admin 3 Password:
1 root@docker02:~# docker pull hello-world 2 root@docker02:~# docker tag hello-world:latest reg.itzgr.com/library/hello-world:xhy 3 root@docker02:~# docker push reg.itzgr.com/library/hello-world:xhy
标签:域名 特性 文件复制 x509 官方 日志收集 protocol sys login
原文地址:https://www.cnblogs.com/itzgr/p/10043402.html