Skip to content

Jenkins docker agent not executing correctly #55

@pahalampi

Description

@pahalampi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions