1.生成docker镜像推送到harbor

从docker登录harbor,并输入登录凭证

docker login https://harbor-k8s.wzs.wistron.com.cn/harbor/projects/1747/repositories

在这里插入图片描述

debug:从docker登录harbor时,出现x509: certificate signed by unknown authority (harbor)

https://noshoes.blog.csdn.net/article/details/81952595
1)进入daemon.json

sudo  vi /etc/docker/daemon.json

2)修改daemon.json

{
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    },
    "insecure-registries": ["harbor-k8s.wzs.wistron.com.cn", "hub.docker.com"],
    "registry-mirrors": ["https://hub.docker.com/"]
} 

3):wq 保存文件并退出vi
4)文件修改后重启docker即可:

sudo service docker restart

5)重新登录就能成功在这里插入图片描述

docker将镜像用tag命令修改为规范的镜像

docker tag SOURCE_IMAGE[:TAG] harbor-k8s.wzs.wistron.com.cn/season/REPOSITORY[:TAG]

docker tag 4c875b230372 harbor-k8s.wzs.wistron.com.cn/season/chengjisihanv3:2.0

推送镜像到Docker Hub

docker push harbor-k8s.wzs.wistron.com.cn/season/REPOSITORY[:TAG]

docker push harbor-k8s.wzs.wistron.com.cn/season/chengjisihanv3:2.0

推送Docker Hub速度很慢,耐心等待,很有可能失败,失败会尝试多次重传。
在这里插入图片描述

传送成功后harbur查看镜像。

在这里插入图片描述

(检查动作)拉取pull已上传的镜像到本地,确认镜像已上传成功

docker pull seasonzhang/chengjisihanv3:1.0

2.Rancher利用镜像部署应用

登录Rancher

在这里插入图片描述

点击Workload,然后import YAML

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

应用已部署

在这里插入图片描述

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐