在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 开源的仓库管理工具Harbor
2 安装
2.1 安装Docker和Docker-compose首先 安装 wget http://rancher-mirror.cnrancher.com/docker-compose/v1.27.4/docker-compose-Linux-x86_64 mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose chmod a+x /usr/local/bin/docker-compose 2.2 安装Harbor2.2.1 下载解压 先到GitHub Release下载对应的包,有 下载: wget https://github.com/goharbor/harbor/releases/download/v2.1.1/harbor-online-installer-v2.1.1.tgz 解压: tar zxvf harbor-online-installer-v2.1.1.tgz 2.2.2 配置并安装 准备配置文件: cp harbor.yml.tmpl harbor.yml 修改配置: hostname: 8.134.18.166 http: port: 8088 # https related config #https: # https port for harbor, default is 443 # port: 443 # The path of cert and key files for nginx #certificate: /your/certificate/path #private_key: /your/private/key/path harbor_admin_password: Harbor12345 改完配置后就开始执行安装: ./install.sh 安装成功会有提示。 3 简单使用3.1 用admin创建用户访问: 管理用户 创建用户的信息: 3.2 新用户创建项目退出 项目创建成功: 3.3 Docker连接仓库3.3.1 修改docker配置并重启 在一台有 vi /etc/docker/daemon.json 配置后内容如下: { "insecure-registries": ["http://8.134.18.166:8088"], "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"], "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2" } 重启 systemctl restart docker 3.3.2 登陆与推送镜像 登陆新建的仓库: $ docker login http://8.134.18.166:8088 --username pkslow --password Pk123456 WARNING! Using --password via the CLI is insecure. Use --password-stdin. WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded 给其中一个镜像打个 docker tag nginx 8.134.18.166:8088/pkslow/nginx:latest 上传镜像到仓库: $ docker push 8.134.18.166:8088/pkslow/nginx:latest The push refers to repository [8.134.18.166:8088/pkslow/nginx] cdd1d8ebeb06: Pushed fe08d9d9f185: Pushed 280ddd108a0a: Pushed f14cffae5c1a: Pushed d0fe97fa8b8c: Pushed latest: digest: sha256:4949aa7259aa6f827450207db5ad94cabaa9248277c6d736d5e1975d200c7e43 size: 1362 到网页检查一下,已经有对应的镜像了: 拉取就不演示了。 到此这篇关于Harbor搭建Docker私有仓库的实现方法的文章就介绍到这了,更多相关Harbor搭建Docker私有仓库内容请搜索极客世界以前的文章或继续浏览下面的相关文章希望大家以后多多支持极客世界! |
请发表评论