docker/daocloud实现自动化部署
2018-08-12 本文已影响106人
codeSirCao
公司让我学习一下docker ,docker当时都没有听说过自己搞了一段时间最后实现还是用的阿里云的docker swarm集群, 并不是自己创建的集群. 而我一个前端的菜鸟估计也只能做到这一步了。 概念性的东西大家还是看官网吧,
docker官方文档 上面的教程很详细。
1:登陆官网
没有注册的先注册 进入控制台

2 创建项目绑定git
注意:仓库里面需要自己写一个Dockerfile 文件 类似于脚本如果不知道的请先学习一下dockerfile的编写
2048该项目是一个游戏可自行发布到自己的仓库测试使用
里面的dockerfile只是一个简单的nginx服务器

定义流程

1:测试阶段
使用默认的基础镜像就可以

2:构建
设置好dockefile的目录 本来就是根目录下所以不用修改其他参数我们也不需要

3 自定义任务
可自定义任务 这里可定义发布但是应为没有主机所以这部可先不需要

4 可设置镜像每次版本
点击右上交的手动触发 选择分支

5 可查看当前构建镜像的进度
这个时候如果你在提交代码会自动构建

创建应用 实现自动化部署
这里需要有一个云主机如果没有可使用胶囊主机测试
只要提交代码自动发布构建

添加主机


如果没有主机可选择胶囊主机 或者使用自己的云主机 但是需要安装好docker

使用胶囊主机 本人买了一个阿里云的主机所以这个不能使用 xshell登陆你的自有主机

安装一下主机监控
curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s a59b924893d8906c0dc90dc7107dd2e1720cc2ee
这段命令复制到我的云主机 回车下载主机监控

docker images查看 会多出来一个镜像


添加应用


