eficode-academy / jenkins-katas

MIT License
4 stars 196 forks source link

Jenkins docker agent not executing correctly #55

Open pahalampi opened 1 year ago

pahalampi commented 1 year ago

While teaching Jenkins using this kata, multiple students confronted an issue where agents defined as docker containers would not execute.

The problem was persistent throughout different OS's and environments: some were running Vagrant (VirtualBox) on Windows, some Docker Desktop on Windows or macOS.

I personally could not reproduce the problem. My environment was running Jenkins on Docker Desktop (Windows) and everything worked as expected.

Only consistent messages that showed in the logs every time the problem occurred was

...
Jenkins does not seem to be running inside a container - -
...

while everywhere where things worked, the corresponding log-entry was

[Pipeline] sh
+ docker inspect -f . gradle:6-jdk11
.
[Pipeline] withDockerContainer
Jenkins seems to be running inside container 7886fea1c6ff2c3c59dba72500f73d00693fc64e06b600635c16c5ec8d76e2f2
$ docker run -t -d -u 0:0 -w /var/jenkins_home/workspace/jenkins-katas_master@2 --volumes-from 7886fea1c6ff2c3c59dba72500f73d00693fc64e06b600635c16c5ec8d76e2f2 -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 ******** -e ******** -e ******** gradle:6-jdk11 cat
$ docker top 58d0ce76181245e4e5a72a3f93718ce18da85a00a159d4ea3d5b78ede3012854 -eo pid,comm