一、安装Harbor
准备:docker 要启动,docker-compose要安装。
下载地址:https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.4.tgz (你也可以下载更新版本)
#tar zxvf harbor-offline-installer-v1.8.4.tgz
# cd harbor
#vi harbor.yml 我只修改了主机地址为该服务器地址,以及端口8080
# cat harbor.yml |grep -v "#"|grep -v "^$" hostname: 10.10.4.85 http: port: 8080 harbor_admin_password: Harbor12345 database: password: root123 data_volume: /data clair: updaters_interval: 12 http_proxy: https_proxy: no_proxy: 127.0.0.1,localhost,core,registry jobservice: max_job_workers: 10 chart: absolute_url: disabled log: level: info rotate_count: 50 rotate_size: 200M location: /var/log/harbor _version: 1.8.0
#./prepare
#./install.sh
........... ........... ✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://10.10.4.85. For more details, please visit https://github.com/goharbor/harbor .
二、使用Harbor
配置docker启动文件:
#vi /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd
配置docker的配置:
# cat /etc/docker/daemon.json {"registry-mirrors": ["http://295c6a59.m.daocloud.io"],"insecure-registries":["10.10.4.85:8080"]}
重启docker:
# systemctl daemon-reload
# systemctl restart docker
登录测试:
# docker login 10.10.4.85:8080
登录的信息账户都保存在:/root/.docker/config.json 中。
只要这个文件不删除,以后登录就不需要账户秘密了。
创建一个base的项目,用于存放jdk、tomcat、nginx等基础镜像。创建一个vonedao项目,用于存储项目镜像
镜像打标签的命令
# docker tag 镜像名:标签 私服地址/仓库项目名/镜像名:标签
[root@test_vonedao_389 ~]# docker tag postgres:9.6 10.10.4.85:8080/base/postgres:9.6
推送到私服的命令
#docker push 私服地址/仓库项目名/镜像名:标签
[root@test_vonedao_389 ~]# docker push 10.10.4.85:8080/base/postgres:9.6 The push refers to repository [10.10.4.85:8080/base/postgres] 25fbcf23de61: Pushed 6bd894c62d2c: Pushed a40ae37e2056: Pushed 2e3d6e77057a: Pushed 2899fabb38b0: Pushed c53e877551cc: Pushed f7608f9dbaaa: Pushed ef3c71448c1d: Pushed a8b4085c8bce: Pushed 26c47736aa5f: Pushed f23f6d995871: Pushed b7f2c5e33820: Pushed db92a710edab: Pushed e0db3ba0aaea: Pushed 9.6: digest: sha256:14eb6a120e527f92c457b6352b14e936107c9a474ea3f63750dbe7db47f619d2 size: 3245
下载镜像:
#从私服拉取镜像的命令 #docker pull 私服地址/仓库项目名/镜像名:标签 # docker pull 10.10.4.85:8080/base/postgres:9.6
查看镜像:
在仓库中存放的位置:
================================================================
更多高阶配置可以参考:https://www.cnblogs.com/kevingrace/p/6547616.html