I\'m using the declarative pipeline syntax to do some CI work inside a docker container.
I\'ve noticed that the Docker plugin for Jenkins runs a container using the
You can also use the args parameter to solve the issue.
As described in Pipeline Syntax:
docker also optionally accepts an args parameter which may contain arguments to pass directly to a docker run invocation.
This is also possible when using dockerfile instead of docker in agent section.
I had the same problem like you and the following lines working fine for me:
agent {
dockerfile {
dir 'Docker/kubernetes-cli'
args '-u 0:0' //Forces Container tu run as User Root
reuseNode true
}
}