拉和运行使用Jenkinsdocker插件的docker图像
我试图找出如何从Jenkins里面的docker hub中拖出一个Docker镜像。 docker插件似乎是要走的路。 然而,尽pipe我可以在公共领域find大量的信息,并且为了构build图像并将它们推送到registry而堆栈溢出,但我正在努力寻找任何用于拉取图像和旋转容器的东西。 我可以find很多像这样的东西:
newImage = docker.build(appNameWithBranch) docker.withRegistry("https://${registryAddress}", ''){ newImage.push("${variables.version}") }
大概一定有一种拉图像的方法,并使用类似的东西来旋转容器?
使用与pipe道一起使用的插件的基本示例:
pipeline { agent { label 'docker' } stages { stage('build') { steps { script { // this pulls an image (groovy:2.4) from docker hub and spins up a container based on it. it exits at the end of the block docker.image('groovy:2.4').inside { sh 'groovy -v' // if you have a file called test.groovy in your jenkins workspace, you can "magically" access it // inside the container sh 'groovy test.groovy' } } // if you want the container to stay up until you shut it down, // you can use docker run and include the -d (daemon) flag. // here i'm also giving the container the name "nginx-oh-yeah": sh 'docker run -d --name nginx-oh-yeah nginx' } } } }
- cf ic插件无法在authentication时finddocker守护进程
- 如何编写Dockerfile来更改Docker镜像中的受保护文本文件?
- 错误检查上下文是可访问的:'不能统计'.gvfs''。 请检查权限,然后重试
- 使用链接/端口转发从另一个容器访问应用程序
- 运行Ubuntu容器的RPI docker
- 如何从运行在Docker容器中的Confluence服务器启用/访问Confluence API
- docker设置推读的超时时间
- 问:为什么在jenkins随机获取'sudo:没有tty present,没有askpass程序指定'错误?
- Docker中为TeamCity代理提供什么服务器URL?