使用Rancher cattle编排容器

#rancher 使用入门
准备条件:首先需要上传docker镜像

推送docker镜像到腾讯云

登录腾讯云
sudo docker login --username=100008761917 hub.tencentyun.com
推送镜像
docker tag d7003dc34f04 hub.tencentyun.com/evanzhou/springcloud:d7003dc34f04
docker push hub.tencentyun.com/evanzhou/springcloud:d7003dc34f04
镜像上传到腾讯云上十分慢不说,还剩最后2M的时候报错了。

搭建docker私服

安装registry

docker
启动registry
docker run -itd -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest

检测

curl http://127.0.0.1:5000/v2/_catalog

解决上传镜像时候,需要https的方法才能上的问题
修改下daemon.json来解决: vim /etc/docker/daemon.json
{
“insecure-registries”: [ “192.168.0.103:5000”]
}

上传镜像

打标签
docker tag evan-springboot-demo:1 192.168.0.103:5000/springboot-demo:v1
push镜像
docker push 192.168.0.103:5000/springboot-demo:v1
检测镜像是否已经上传成功
curl http://127.0.0.1:5000/v2/_catalog

拉取镜像

同理需要解决上面的不能http客户端不能发送https请求问题
docker pull 192.168.0.103:5000/springboot-demo:v1

搭建私服参考文档:https://www.linuxidc.com/Linux/2018-03/151308.htm

rancher 安装

– docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable

rancher 启动

docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable

在rancher里部署应用

1、添加主机,,选择Custome,指定racher-agent的ip地址,然后将脚本拷贝到racher主机上执行
2、添加环境
3、添加服务

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章