Hi,
I have a customized Docker image that I’m trying to run as a Jenkins docker build agent. Refer to the Jenkins official doc here Using Docker with Pipeline
However, getting this following error:-
**java.io.IOException: Failed to run image 'jenkinsagent/test-image:1.1.0'. Error: docker: invalid reference format.**
That argument ‘abc’ is not getting passed properly in the following piece of code of Jenkinsfile:-
agent {
docker {
image 'jenkinsagent/test-image:1.1.0'
args '-v ${HOME}/new/test/.aws:/root/.aws:ro -e XDG_CACHE_HOME=/tmp/go/.cache abc'
}
}
If I run the same container on my local terminal by sending the same argument ‘abc’ then it works fine:-
`docker run -v $PWD/.aws:/root/.aws:ro -e XDG_CACHE_HOME=/tmp/go/.cache jenkinsagent/test-image:1.1.0 abc`
If I do not pass that argument then the container works fine in the Jenkins server as well however my requirement is to pass that argument only. May I know how can I pass any arguments in the following syntax of Jenkins docker build agent:-
agent {
docker {
image 'jenkinsagent/test-image:1.0.0'
args '-v ${HOME}/new/test/.aws:/root/.aws:ro -e XDG_CACHE_HOME=/tmp/go/.cache abc'
}
}