What Operating System are you using (both controller, and any agents involved in the problem)?
Linux/RHEL8
Jenkins on RHEL or Centos
Reproduction steps
Set the user to run as using uid:gid or username
Run the container
Watch it crash and burn
If I don't do step 1 container runs fine
Expected Results
For container to run as the specified user
Actual Results
Connecting to docker container 3917385bc4d436155d1b1c3efc8065e2678f047a5412e269bddb52e831eb6715, running command java -jar //remoting-3248.3250.v3277a8e88c9b.jar -noReconnect -noKeepAlive -agentLog //agent.log
HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
Api-Version: 1.47
Docker-Experimental: false
Ostype: linux
Server: Docker/27.2.1 (linux)
ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
Also: java.lang.Throwable: launched here
at hudson.slaves.SlaveComputer._connect(SlaveComputer.java:286)
at hudson.model.Computer.connect(Computer.java:451)
at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy.start(DockerOnceRetentionStrategy.java:145)
at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy.start(DockerOnceRetentionStrategy.java:49)
at hudson.model.AbstractCIBase.createNewComputerForNode(AbstractCIBase.java:192)
at hudson.model.AbstractCIBase.updateNewComputer(AbstractCIBase.java:221)
at jenkins.model.Jenkins.updateNewComputer(Jenkins.java:1686)
at jenkins.model.Nodes.addNode(Nodes.java:154)
at jenkins.model.Jenkins.addNode(Jenkins.java:2250)
at PluginClassLoader for docker-plugin//io.jenkins.docker.DockerTransientNode.robustlyAddToJenkins(DockerTransientNode.java:448)
at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.DockerCloud$1.run(DockerCloud.java:421)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
java.io.EOFException: unexpected stream termination
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:459)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404)
at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:440)
at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:407)
at PluginClassLoader for docker-plugin//io.jenkins.docker.connector.DockerComputerAttachConnector$DockerAttachLauncher.launch(DockerComputerAttachConnector.java:347)
at hudson.slaves.DelegatingComputerLauncher.launch(DelegatingComputerLauncher.java:64)
at PluginClassLoader for docker-plugin//io.jenkins.docker.connector.DockerDelegatingComputerLauncher.launch(DockerDelegatingComputerLauncher.java:46)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Anything else?
If I user the docker run command with the same uid:gid using the --user option it works fine.
Jenkins and plugins versions report
Environment
```text Paste the output here ```What Operating System are you using (both controller, and any agents involved in the problem)?
Linux/RHEL8 Jenkins on RHEL or Centos
Reproduction steps
Expected Results
For container to run as the specified user
Actual Results
Connecting to docker container 3917385bc4d436155d1b1c3efc8065e2678f047a5412e269bddb52e831eb6715, running command java -jar //remoting-3248.3250.v3277a8e88c9b.jar -noReconnect -noKeepAlive -agentLog //agent.log HTTP/1.1 101 UPGRADED Content-Type: application/vnd.docker.raw-stream Connection: Upgrade Upgrade: tcp Api-Version: 1.47 Docker-Experimental: false Ostype: linux Server: Docker/27.2.1 (linux) ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins Also: java.lang.Throwable: launched here at hudson.slaves.SlaveComputer._connect(SlaveComputer.java:286) at hudson.model.Computer.connect(Computer.java:451) at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy.start(DockerOnceRetentionStrategy.java:145) at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy.start(DockerOnceRetentionStrategy.java:49) at hudson.model.AbstractCIBase.createNewComputerForNode(AbstractCIBase.java:192) at hudson.model.AbstractCIBase.updateNewComputer(AbstractCIBase.java:221) at jenkins.model.Jenkins.updateNewComputer(Jenkins.java:1686) at jenkins.model.Nodes.addNode(Nodes.java:154) at jenkins.model.Jenkins.addNode(Jenkins.java:2250) at PluginClassLoader for docker-plugin//io.jenkins.docker.DockerTransientNode.robustlyAddToJenkins(DockerTransientNode.java:448) at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.DockerCloud$1.run(DockerCloud.java:421) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) java.io.EOFException: unexpected stream termination at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:459) at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:440) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:407) at PluginClassLoader for docker-plugin//io.jenkins.docker.connector.DockerComputerAttachConnector$DockerAttachLauncher.launch(DockerComputerAttachConnector.java:347) at hudson.slaves.DelegatingComputerLauncher.launch(DelegatingComputerLauncher.java:64) at PluginClassLoader for docker-plugin//io.jenkins.docker.connector.DockerDelegatingComputerLauncher.launch(DockerDelegatingComputerLauncher.java:46) at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840)
Anything else?
If I user the docker run command with the same uid:gid using the --user option it works fine.
Are you interested in contributing a fix?
I am user, not a programmer.