-
Bug
-
Resolution: Unresolved
-
Blocker
-
None
-
Jenkins ver. 2.121.1
OS- information :
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Openjdk-9
plugins installed:
All suggested plugins -latest
Allure Jenkins Plugin-2.26.0
Robot Framework plugin-1.6.4
SonarQube Scanner for Jenkins-2.7.1
Jenkins ver. 2.121.1 OS- information : NAME="Ubuntu" VERSION="16.04.4 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.4 LTS" VERSION_ID="16.04" HOME_URL=" http://www.ubuntu.com/ " SUPPORT_URL=" http://help.ubuntu.com/ " BUG_REPORT_URL=" http://bugs.launchpad.net/ubuntu/ " VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial Openjdk-9 plugins installed: All suggested plugins -latest Allure Jenkins Plugin-2.26.0 Robot Framework plugin-1.6.4 SonarQube Scanner for Jenkins-2.7.1
Hi Developer,
I am facing some problem while using withDockerContainer step in my jenkins descriptive pipeline script(jenkinsfile), the problems are mentioned below,
1. If i use -w in args and mention custom workspace its not choosing mentioned custom workspace instead it is choosing the default one.
2. If i use -e in args its throwing error invalid argument "=" for "-e, --env" flag: invalid environment variable: = See 'docker exec --help'.
3. even though we do not pass -e args its throwing the above mentioned error
steps to reproduce the above issues:
create a job with pipeline and choose pipeline script and copy paste below mentioned code in to script editor
pipeline {
agent
{ label "build" } stages {
stage("test") {
steps {
withDockerContainer (image: 'busybox')
}
}
}
}
Console output:
Running on build-server in /home/ubuntu/workspace/sandbox/withdocker
[Pipeline] {
[Pipeline] stage
[Pipeline] { (test)
[Pipeline] withDockerContainer
build-server does not seem to be running inside a container
$ docker run -t -d -u 1000:1000 -w /home/ubuntu/workspace/sandbox/withdocker -v /home/ubuntu/workspace/sandbox/withdocker:/home/ubuntu/workspace/sandbox/withdocker:rw,z -v /home/ubuntu/workspace/sandbox/withdocker@tmp:/home/ubuntu/workspace/sandbox/withdocker@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** busybox cat
$ docker top 661025c3ef5f46681fd3f9c73c8e0522c7dbcbbf35d8531aab0aa4739d5ee840 -eo pid,comm
[Pipeline]
{ [Pipeline] sh [withdocker] Running shell script invalid argument "=" for "-e, --env" flag: invalid environment variable: = See 'docker exec --help'. process apparently never started in /home/ubuntu/workspace/sandbox/withdocker@tmp/durable-a265513a [Pipeline] }$ docker stop --time=1 661025c3ef5f46681fd3f9c73c8e0522c7dbcbbf35d8531aab0aa4739d5ee840
$ docker rm -f 661025c3ef5f46681fd3f9c73c8e0522c7dbcbbf35d8531aab0aa4739d5ee840
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILUR