jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-39746] Allow running exec directly from a Container object
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
When you have a running container (via docker.image('foo').run() it's very useful to be able to execute a command directly in the container (eg ansible) and keep with the Jenkinsfile syntax, rather than 'sh' everything
It should be possible to do something like the following:
def con = docker.image('myapp').run()
con.exec('ansible localhost /myapp/yoo.yml')
sh 'make test'
con.stop()
Having this functionality then makes handling testing requiring multiple containers much simpler.
---
Originally reported by
hogarthj, imported from: Allow running exec directly from a Container object
hogarthj
Raw content of original issue
When you have a running container (via docker.image('foo').run() it's very useful to be able to execute a command directly in the container (eg ansible) and keep with the Jenkinsfile syntax, rather than 'sh' everything
It should be possible to do something like the following:
def con = docker.image('myapp').run()
con.exec('ansible localhost /myapp/yoo.yml')
sh 'make test'
con.stop()Having this functionality then makes handling testing requiring multiple containers much simpler.
Contributor guide
Assessment
This issue has not been assessed yet.