Declarative pipeline - pass command arguments to docker run

17 views
Skip to first unread message

Alex Dinescu

unread,
Mar 15, 2019, 9:29:24 AM3/15/19
to Jenkins Users
Hi,

Is there a way to pass parameters to the docker run entrypoint comand?
what i mean is, for the run command I need to have something like this:
docker run myImage -Dhost.url.expected=http://url -Dhost.url.actual=http://url

Currently the pipeline that I've build would look like:

agent {
 dockerfile
{
 args
'-Dhost.url.expected=${params.EXPECTED} -Dhost.url.actual=${params.ACTUAL}'
 
}
}

but like this, will actually do something like:
docker run -Dhost.url.expected=http://url -Dhost.url.actual=http://url myImage
causing the script to fail of course

is there a way to achieve what I need?
Ideally still using a declarative pipeline... with as less boilerplate as possible

Let me know if you need more details, I can add the whole jenkinsfile / dockerfile if needed

Thanks!



Reply all
Reply to author
Forward
0 new messages