前言:
如今各位老铁们对“docker 配置镜像仓库”大体比较关注,兄弟们都想要学习一些“docker 配置镜像仓库”的相关资讯。那么小编同时在网摘上网罗了一些有关“docker 配置镜像仓库””的相关文章,希望各位老铁们能喜欢,各位老铁们快快来学习一下吧!Docker私有镜像仓库Harbor介绍
Harbor 是为企业用户设计的开源镜像仓库项目,包括了权限管理(RBAC)、LDAP、审计、安全漏洞扫描、镜像验真、管理界面、自我注册、HA等企业必需的功能,同时针对中国用户的特点,设计镜像复制和中文支持等功能。
官网:
Harbor安装部署
可以准备台新的虚拟机:docker02 10.0.0.200 2核4G
# 1.harbor安装的环境要求安装Harbor必须有docker环境和docker-compose环境yum install -y docker-ceyum install -y docker-compose# 2.解压harbor安装包[root@docker02 ~]# tar xf harbor-offline-installer-v1.9.0-rc1.tgz[root@docker02 ~/harbor]# lltotal 605144-rw-r--r-- 1 root root 619632806 Sep 4 2019 harbor.v1.9.0.tar.gz-rw-r--r-- 1 root root 5805 Sep 4 2019 harbor.yml-rwxr-xr-x 1 root root 5088 Sep 4 2019 install.sh-rw-r--r-- 1 root root 11347 Sep 4 2019 LICENSE-rwxr-xr-x 1 root root 1748 Sep 4 2019 prepare# 3.修改harbor配置[root@docker03 ~/harbor]# vim harbor.ymlhostname: 10.0.0.200harbor_admin_password: Harbor12345# 4.执行安装脚本[root@docker02 ~/harbor]# sh install.sh[Step 1]: loading Harbor images ...Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?# 5.启动docker[root@docker02 ~/harbor]# systemctl start docker[root@docker02 ~/harbor]# sh install.sh[Step 0]: checking installation environment ...Note: docker version: 24.0.7Note: docker-compose version: 1.18.0[Step 1]: loading Harbor images .........[Step 2]: preparing environment .........Creating redis ... doneCreating harbor-core ... doneCreating network "harbor_harbor" with the default driverCreating nginx ... doneCreating harbor-db ...Creating registryctl ...Creating harbor-portal ...Creating redis ...Creating registry ...Creating harbor-core ...Creating nginx ...Creating harbor-jobservice ...✔ ----Harbor has been installed and started successfully.----Now you should be able to visit the admin portal at more details, please visit .# 6.浏览器访问用户名admin密码Harbor12345
[root@docker02 ~]# docker images //看下,拉了一堆镜像REPOSITORY TAG IMAGE ID CREATED SIZEgoharbor/chartmuseum-photon v0.9.0-v1.9.0 47c00be3913e 4 years ago 130MBgoharbor/harbor-migrator v1.9.0 9826462ead7c 4 years ago 363MBgoharbor/redis-photon v1.9.0 9796fe9032f1 4 years ago 108MBgoharbor/clair-photon v2.0.9-v1.9.0 e5a73c27b22e 4 years ago 166MBgoharbor/notary-server-photon v0.6.1-v1.9.0 08d02db09b49 4 years ago 137MBgoharbor/notary-signer-photon v0.6.1-v1.9.0 913e9aa35746 4 years ago 134MBgoharbor/harbor-registryctl v1.9.0 a6047b548692 4 years ago 98.9MBgoharbor/registry-photon v2.7.1-patch-2819-v1.9.0 259d4564763f 4 years ago 81.6MBgoharbor/nginx-photon v1.9.0 492e9528214c 4 years ago 43.2MBgoharbor/harbor-log v1.9.0 3557c7f5f0cb 4 years ago 81.8MBgoharbor/harbor-jobservice v1.9.0 568965abe6cb 4 years ago 140MBgoharbor/harbor-core v1.9.0 40109d4c5019 4 years ago 155MBgoharbor/harbor-portal v1.9.0 73fe60318ae4 4 years ago 50.6MBgoharbor/harbor-db v1.9.0 3d5add651733 4 years ago 145MBgoharbor/prepare v1.9.0 9c4b913b6fb4 4 years ago 146MB
Harbor的使用
harbor新建项目
新建一个h5_games项目,在里面可以看到相关推送镜像的命令。
在harbor中上传镜像
例:将上节docker01机器构建的小游戏镜像上传至harbor
# 1.修改镜像名称# 查看镜像[root@docker01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnginx c7_v3 b61e011c7a89 28 hours ago 289MB# 给镜像改名(会生成一个新的镜像,与原镜像同一个ID)[root@docker01 ~]# docker tag nginx:c7_v3 10.0.0.200/h5_games/nginx:c7_v3[root@docker01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE10.0.0.200/h5_games/nginx c7_v3 88b3d5a6d73f 2 hours ago 289MBnginx c7_v3 88b3d5a6d73f 2 hours ago 289MB###命名规则###照着上面截图命名即可:harbor服务器地址/项目名称/镜像名称:标签10.0.0.200/h5_games/nginx:c7_v3# 2.修改docker配置文件,信任harbor仓库地址[root@docker01 /etc/docker]# vim daemon.json{ "bip": "192.168.10.1/24", "registry-mirrors": [";], "insecure-registries": [";]}[root@docker01 ~]# systemctl restart docker# 3.登录harbor[root@docker01 ~]# docker login 10.0.0.200Username: adminPassword:WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. See Succeeded# 4.推送镜像[root@docker01 ~]# docker push 10.0.0.200/h5_games/nginx:c7_v3The push refers to repository [10.0.0.200/h5_games/nginx]cc5163efebe5: Pusheddff3e2c393d5: Pushed174f56854903: Pushedc7_v3: digest: sha256:c1dd2312005598b49a1c2071ad86f45cd084eb46ffe3b2cc378417957f07fd1a size: 953
刷新查看:
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #docker 配置镜像仓库 #docker 配置镜像仓库地址 #docker私有仓库nginx #docker compose 私有镜像