jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-39746] Allow running exec directly from a Container object

Open
#454 3 comments 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
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


  • assignee: hogarthj
  • status: In Review
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-07

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.