Harbor仓库离线部署

Harbor仓库离线部署

harbor安装包下载地址:harbor

环境准备

系统: Centos7 1C1G
docker
docker-compose

[root@localhost ~]# docker --version
Docker version 19.03.13, build 4484c46d9d
[root@localhost ~]# docker-compose --version
docker-compose version 1.26.2, build eefe0d31

1.安装harbor

[root@localhost ~]# ls
anaconda-ks.cfg  harbor-offline-installer-v1.9.4.tgz
[root@localhost ~]# tar zxf harbor-offline-installer-v1.9.4.tgz
[root@localhost ~]# mv harbor /usr/local/
[root@localhost ~]# cd /usr/local/harbor/
[root@localhost harbor]# vim harbor.yml 
//修改这些
hostname: 192.168.176.137
http:
  port: 80
harbor_admin_password: admin
[root@localhost harbor]# ls
harbor.v1.9.4.tar.gz  harbor.yml  install.sh  LICENSE  prepare
[root@localhost harbor]# ./install.sh 
//[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating registry      ... done
Creating redis         ... done
Creating harbor-db     ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done

✔ ----Harbor has been installed and started successfully.----


[root@localhost harbor]# cat /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://q3u0qv3z.mirror.aliyuncs.com"],
   "insecure-registries":["192.168.176.137"]
}
[root@localhost harbor]# systemctl daemon-reload
[root@localhost harbor]# systemctl restart docker

2.登录私有仓库

[root@localhost harbor]# docker login 192.168.176.137
Username: admin
Password: 
Error response from daemon: Get http://192.168.176.137/v2/: dial tcp 192.168.176.137:80: connect: connection refused   
//没有登录成功,需要重启harbor相关容器
[root@localhost harbor]# docker-compose down -v
[root@localhost harbor]# docker-compose up -d 
[root@localhost harbor]# docker-compose ps
      Name                     Command                       State                     Ports          
------------------------------------------------------------------------------------------------------
harbor-core         /harbor/harbor_core              Up (health: starting)                            
harbor-db           /docker-entrypoint.sh            Up (health: starting)   5432/tcp                 
harbor-jobservice   /harbor/harbor_jobservice  ...   Up (health: starting)                            
harbor-log          /bin/sh -c /usr/local/bin/ ...   Up (health: starting)   127.0.0.1:1514->10514/tcp
harbor-portal       nginx -g daemon off;             Up (health: starting)   8080/tcp                 
nginx               nginx -g daemon off;             Up (health: starting)   0.0.0.0:80->8080/tcp     
redis               redis-server /etc/redis.conf     Up (health: starting)   6379/tcp                 
registry            /entrypoint.sh /etc/regist ...   Up (health: starting)   5000/tcp                 
registryctl         /harbor/start.sh                 Up (health: starting)  
//重新登录
[root@localhost harbor]# docker login 192.168.176.137
Username: admin
Password: 
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

3.登录Harbor

//关闭防火墙
[root@localhost harbor]# systemctl stop firewalld
[root@localhost harbor]# setenforce 0

访问端口为 80

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

4.向harbor仓库中推送mysql镜像

[root@localhost harbor]# docker pull mysql:5.7
[root@localhost harbor]# docker tag mysql:5.7 192.168.176.137/docker/mysql:5.7
[root@localhost harbor]# docker push 192.168.176.137/docker/mysql:5.7

在这里插入图片描述

5.从harbor仓库中下载镜像

[root@localhost harbor]# docker pull 192.168.176.137/docker/mysql:5.7 
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值