Docker连接General Version Control System(Gitlab/Github)自动build

由于官方只支持Docker连接Github的自动build,那么我们使用其他version control(如Gitlab,CVS等)的同学们应该怎么做呢。

博主使用的方案是jenkins+jenkins提供的docker插件。

需要用到DooD (Docker-outside-of-Docker) 或者DinD(Docker-in-Docker)技术。

具体参照:

http://container-solutions.com/running-docker-in-jenkins-in-docker/

在jenkins容器可以访问docker命令完成以后,继续安装相关jenkins上的docker插件来完成gitlab上docker的自动build过程。

本文中使用的docker相关插件包括以下五个(参考文章http://www.linuxidc.com/Linux/2015-07/120287.htm):

  • CloudBees Docker Build and Publish plugin — This plugin provides the ability to build projects with a Dockerfile, and publish the resultant tagged image (repo) to the docker registry.
  • Docker build step plugin — This plugin allows to add various Docker commands into you job as a build step.
  • Docker Plugin — This plugin allows slaves to be dynamically provisioned using Docker.
  • Kubernetes Plugin — This plugin allows slaves to be dynamically provisioned on multiple Docker hosts using Kubernetes.
  • Docker Commons Plugin — APIs for using Docker from other plugins.

其中,它们间的关系如下:

  • Docker commons Plugin为其他与Docker相关的插件提供了APIs
  • CloudBees Docker Build and Publish plugin和Docker build step plugin都依赖了Docker commons Plugin
  • Kubernetes Plugin依赖了Docker Plugin

坑:

在上图kitematic界面中点击右下侧任意一个路径,会弹出如图对话框,若选择Enable Volumes会发生四件坏事:

1.强制重启jenkins server,即便有job没有完成;

2.重启后需要重新安装jenkins插件;

3.导致jenkins无法使用DooD的docker命令。

3.admin用户的密码会改变。

所以切记任何时候使用jenkins容器不要点选enable volumes。

解决办法:

停止(删除)docker,重新运行以下命令并配置新的jenkins容器。

docker run -d -v /var/run/docker.sock:/var/run/docker.sock \

-v $(which docker):/usr/bin/docker -p 8080:8080 myjenk

时间: 2024-08-28 06:24:08

Docker连接General Version Control System(Gitlab/Github)自动build的相关文章

【小问题】为啥乱搞就不行,golang没安装在系统目录下,导致go get出现"package bytes: directory "/home/ahfu/go/src/bytes" is not using a known version control system"

想在自己的账号下安装golang开发环境,于是这样配置: wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz cd /home/ahfu tar -zxvf go1.14.2.linux-amd64.tar.gz 配置.bashrc su ahfu vi ~/.bashrc export PATH=$PATH:/home/ahfu/go/bin export GOROOT=/home/ahfu/go/ export GOPATH=/

version control system:git/hg/subversion/cvs/clearcase/vss。software configruation management。代码集成CI:Cruisecontrol/hudson/buildbot

version control system: git/hg/subversion/cvs/clearcase/vss software configruation management: daily build/smoke test/auto test 代码集成CI: Cruisecontrol/hudson/buildbot

Docker连接Github自动build

具体参见代码库: https://github.com/flasheryu/docker-jetty 在Docker Hub的settings里面设置连接个人github账号. 然后在dockerhub创建一个新的repository并关联到github此repository即可. 每当有新代码check in的时候,Docker Hub会自动build Dockerfile生成最新的image. 另外:jenkins可以完成同样的流程. 后续会使用jenkins生成image并将新生成的ima

Put Everything Under Version Control

Put Everything Under Version Control Diomidis Spinellis PUT EVERYTHiNG iN ALL YOUR PROjECTS UNDER VERSiON CONTROL. The resources you need are there: free tools like Subversion, Git, Mercurial, and CVS; plentiful disk space; cheap and powerful servers

idea连接数据库和版本控制(Version Control)

连接数据库(以mysql为例) 点击database,点击+号date source,点击Mysql. 输入host主机名,database数据库名,user用户名,和password密码. 第一次使用左下角有download missing driver files点击它进行下载(不要连联通网络!否则下载不了) 可以点击test conection进行测试,显示successful就算成功. 库里的表都显示出来了,点击左下角DDL进行sql语句的编写 下面是版本控制(Version Contr

Gitlab CI 自动部署 asp.net core web api 到Docker容器

为什么要写这个? 在一个系统长大的过程中会经历不断重构升级来满足商业的需求,而一个严谨的商业系统需要高效.稳定.可扩展,有时候还不得不考虑成本的问题.我希望能找到比较完整的开源解决方案来解决持续集成.监控报警.以及扩容和高可用性的问题.是学习和探索的过程分享给大家,也欢迎同行的人交流. 先来一个三步曲,我们将完成通过GitLab CI 自动部署 net core web api 到Docker 容器的一个示例.这是第一步,通过此文您将了解如何将net core web api 运行在Docker

初识版本控制(version control)

最近写论文心烦,考虑到自己做的港口设备远程监控系统项目,两人分工共同完成,同时由于自己经常同时在多台电脑上操作调试程序(调试网络程序.自己电脑与港口电脑),需要不断同步代码,之前自己一直使用的比较土的[文本比较器]来判断 程序中哪些地方修改了.虽然后期加入了 修改历史history.txt这个文件,但总是忘记更新该文件. 考虑到最近比较火的版本控制(Version control),下午自己就学习了一把,将版本控制及相关文件的更新比较操作交给计算机来完成. 首先,自己一直听说代码托管软件GitH

[转]Resolve Team Foundation Version Control conflicts

本文转自:http://msdn.microsoft.com/en-us/library/ms181432.aspx An advantage of using Team Foundation version control to manage your files is that several people can work concurrently on a file. One drawback is that sometimes you must resolve conflicts be

svn is already under version control问题解决

svn ci 时出现 xx is already under version control,然后无法提交,出现这个问题的原因是你所提交的文件或目录是其他SVN的东西,即下面有.svn的目录,需要先把它们删除才能提交,具体操作如下: 打开出现问题的那个目录,然后查找.svn文件,删除.svn文件,然后资源同步.