1. 安装docker-compose
yum install -y epel-release
yum install -y python-pip
pip install --upgrade pip
pip install docker-compose
docker-compose -version
2. 安装harbor
- 参考官方文档: https://goharbor.io/docs/2.0.0/install-config/configure-yml-file/
- 参考harbor安装: https://blog.csdn.net/qq_24095941/article/details/86063684
- 参考harbor安装: https://blog.csdn.net/qq_40378034/article/details/90752212
- 下载安装包: https://github.com/goharbor/harbor/releases
解压开
tar -zxvf harbor-offline-installer-v2.1.0.tgz
cd harbor
把配置文件复制为 harbor.yml
cp harbor.yml.tmpl harbor.yml
修改配置文件,
vi harbor.yml
# hostname设置访问地址,可以使用ip、域名,不可以设置为127.0.0.1或localhost
hostname: 192.168.220.143
#端口修改下, 访问使用
http:
port: 8889
#https的全部注释掉
#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
#database的密码改成123456, 默认是root123
database:
# The password for the root user of Harbor DB. Change this before any production use.
password: 123456
#admin的登录密码默认Harbor12345, 改成123456
harbor_admin_password: Harbor12345
执行安装
./install.sh
访问192.168.220.143:8889 admin/123456
然后新建个公开项目 harbor_first
按照命令推送镜像
配置docker信任仓库
vi /etc/docker/daemon.json
登录仓库
docker login 192.168.220.143:8889
输入密码123456
tar镜像
docker tag jdk1.8 192.168.220.143:8889/harbor_first/jdk1.8
push镜像
docker push 192.168.220.143:8889/harbor_first/jdk1.8
就能看到镜像了
harbor是用docker-compose来管理的
docker-compose start/stop/restart