Harbor镜像仓库v2.1.0_2安装与使用
作者:互联网
基础配置
主机名 | IP | 系统版本 | harbor版本 |
---|---|---|---|
harbor | 172.21.3.23 | CentOS7.8 | v2.1.0_2 |
1|0安装docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose #给docker-compose添加执行权限 sudo chmod +x /usr/local/bin/docker-compose #查看docker-compose是否安装成功 $ docker-compose -version docker-compose version 1.25.0, build 0a186604
2|0下载Harbor的压缩包
https://github.com/goharbor/harbor/releases #上传压缩包到linux,并解压 tar -xzf harbor-offline-installer-v2.1.0_2.tgz mkdir /opt/harbor mv harbor/* /opt/harbor cd /opt/harbor
3|0修改Harbor的配置
#没有的话复制harbor.yml.tmpl vi harbor.yml 修改hostname和port hostname: 172.21.3.23 port: 80 #注释掉https这段 # 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
4|0安装Harbor
./install.sh
5|0启动、停止Harbor
docker-compose up -d 启动 docker-compose stop 停止 docker-compose restart 重新启动
6|0访问Harbor
http://172.21.3.23 默认账户密码:admin/Harbor12345
7|0将仓库添加到docker配置里面
$ vim /etc/docker/daemon.json { "insecure-registries": ["172.21.3.23"] } $ systemctl restart docker
8|0登录Harbor仓库
[root@k8s-n1 harbor]# docker login 172.21.3.23 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
9|0上传镜像
$docker push 172.21.3.23/library/nginx:latest The push refers to repository [172.21.3.23/library/nginx] 6c7de695ede3: Pushed 2f4accd375d9: Pushed ffc9b21953f4: Pushed latest: digest: sha256:8269a7352a7dad1f8b3dc83284f195bac72027dd50279422d363d49311ab7d9b size: 948
标签:compose,Harbor,v2.1,harbor,https,镜像,docker,172.21 来源: https://www.cnblogs.com/Python-K8S/p/14142609.html