【Kubernetes/docker】生成docker镜像推送到harbor并在Rancher部署应用-20221110
生成docker镜像推送到harbor从docker登录harbor,并输入登录凭证docker login https://harbor-k8s.wzs.wistron.com.cn/harbor/projects/1747/repositoriesdocker将镜像用tag命令修改为规范的镜像docker tag SOURCE_IMAGE[:TAG] harbor-k8s.wzs.wistro
·
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
应用已部署
更多推荐
已为社区贡献14条内容
所有评论(0)