前序:
        🔗第一步:私有镜像仓库Harbor的安装部署

一、将容器打包为镜像,上传到Harbor

1、查看镜像

输入命令

docker images

打印返回

REPOSITORY                             TAG       IMAGE ID       CREATED        SIZE
ubuntu                                 16.04     b6f507652425   2 years ago    135MB

2、查看容器

输入命令

docker ps -a

打印返回

CONTAINER ID   IMAGE          COMMAND   CREATED      STATUS                    PORTS                                   NAMES
e80c30a2e599   ubuntu:16.04   "bash"    7 days ago   Exited (0) 18 hours ago   0.0.0.0:8801->80/tcp, :::8801->80/tcp   ubuntu-1

1、打包容器

docker commit -a "lxcw"  -m "for vAC keepalived+nginx" ubuntu-1 vac_ubuntu:v0.1

2、查看镜像

输入命令

docker images

打印返回

REPOSITORY                              TAG       IMAGE ID       CREATED        SIZE
vac_ubuntu                              v0.1      b1e07b814206   23 hours ago   444MB
ubuntu                                  16.04     b6f507652425   2 years ago    135MB

3、标记镜像

 docker tag vac_ubuntu:v0.1 192.168.100.120:8802/library/vac_ubuntu:v0.1

4、查看镜像

输入命令

docker images

打印返回

REPOSITORY                              TAG       IMAGE ID       CREATED        SIZE
vac_ubuntu                              v0.1      b1e07b814206   23 hours ago   444MB
192.168.100.120:8802/library/vac_ubuntu v0.1      b1e07b814206   23 hours ago   444MB
ubuntu                                  16.04     b6f507652425   2 years ago    135MB

2、登录仓库

docker login -u admin -p Harbor12345 192.168.100.120:8802

2、上传镜像

输入命令

docker push 192.168.100.120:8802/library/vac_ubuntu:v0.1

打印返回

The push refers to repository [192.168.100.120:8802/library/vac_ubuntu]
fedb7970623a: Pushed 
1251204ef8fc: Pushed 
47ef83afae74: Pushed 
df54c846128d: Pushed 
be96a3f634de: Pushed 

二、从Harbor拉取镜像到本地

1、查看本地已存在镜像

docker images
REPOSITORY                              TAG       IMAGE ID       CREATED        SIZE
vac_ubuntu                              v0.1      b1e07b814206   23 hours ago   444MB
192.168.100.120:8802/library/vac_ubuntu v0.1      b1e07b814206   23 hours ago   444MB
ubuntu                                  16.04     b6f507652425   2 years ago    135MB

2、已存在,先删除

docker rmi 192.168.100.120:8802/library/vac_ubuntu:v0.1

3、查看镜像

输入命令

 docker images

打印返回

REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
vac_ubuntu   v0.1      b1e07b814206   24 hours ago   444MB
ubuntu       16.04     b6f507652425   2 years ago    135MB

3、拉取镜像

docker pull 192.168.100.120:8802/library/vac_ubuntu:v0.1

4、查看镜像

输入命令

docker images

打印返回

REPOSITORY                              TAG       IMAGE ID       CREATED        SIZE
192.168.100.120:8802/library/vac_ubuntu v0.1      b1e07b814206   24 hours ago   444MB
vac_ubuntu                              v0.1      b1e07b814206   24 hours ago   444MB
ubuntu                                  16.04     b6f507652425   2 years ago    135MB

三、一些问题?

1、connect: no route to host

问题重现

The push refers to repository [192.168.100.120:8802/library/vac_ubuntu]
Get "http://192.168.100.120:8802/v2/": dial tcp 192.168.100.120:8802: connect: no route to host
原因: 防火墙未允许8802端口通过,关闭Harbor仓库所在主机的防火墙,或者打开8802端口规则
解决方法: 关闭防火墙

输入命令

systemctl stop firewalld

2、connect: connection refused

问题重现

Error response from daemon: Get "http://192.168.100.120:8802/v2/": dial tcp 192.168.100.120:8802: connect: connection refused
原因: docker客户端未添加白名单,即忽略安全注册表
解决方法: 如下

输入命令

vim /etc/docker/daemon.json

增加内容

{
	"insecure-registries": ["192.168.100.120:8802"]
}

重启守护进程

systemctl daemon-reload

重启docker

systemctl restart docker

测试登录

docker login -u admin -p Harbor12345 192.168.100.120:8802
GitHub 加速计划 / ha / harbor
10
3
下载
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:6 个月前 )
45659070 Fix integration issue with UI Signed-off-by: stonezdj <stone.zhang@broadcom.com> 9 天前
add0b600 chore(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp Bumps [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go) from 1.31.0 to 1.34.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.31.0...v1.34.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 11 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐