jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-49278] cat command in docker agents not detected correctly

Open
#549 61 comments 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

When using a declarative Jenkins pipeline with a stage that uses a Docker agent, I get a confusing error message in the Jenkins log:

$ docker top 08e1c013e07083492ad0f03285f1a7d30063fb15e0cf39be7b55af6d1a03c829

ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument. See https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#entrypoint for entrypoint best practices.

The build continues normally and the cat command is actually running inside the container, so everything is fine except that the error message occurs although it shouldn't.

Comparing the code in listProcess in https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java with the output of docker top shows the likely cause of that error:

docker top prints the following fields

UID PID PPIDC   STIME       TTY TIMECMD

build 19799 19784 0 22:23 pts/0 00:00:00 cat

However, the Java client assumes that only PID, USER, TIME and COMMAND is printed. I suggest that the process list is determined by using an explicit format specifier like

docker container top ${CONTAINER_ID} -eo pid,comm

---
Originally reported by hendrikhalkow, imported from: cat command in docker agents not detected correctly


  • status: Reopened
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 4
  • watchers: 35
  • imported: 2025-12-07

Raw content of original issue

When using a declarative Jenkins pipeline with a stage that uses a Docker agent, I get a confusing error message in the Jenkins log:


$ docker top 08e1c013e07083492ad0f03285f1a7d30063fb15e0cf39be7b55af6d1a03c829

ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument. See https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#entrypoint for entrypoint best practices.

The build continues normally and the cat command is actually running inside the container, so everything is fine except that the error message occurs although it shouldn't.

Comparing the code in listProcess in https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java with the output of docker top shows the likely cause of that error:

docker top prints the following fields



UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD

build 19799 19784 0 22:23 pts/0 00:00:00 cat

However, the Java client assumes that only PID, USER, TIME and COMMAND is printed. I suggest that the process list is determined by using an explicit format specifier like



docker container top ${CONTAINER_ID} -eo pid,comm


  • environment: Jenkins 2.104 on Docker 17.10.0-ce on CentOS 7.4.1708 (Kernel 3.10.0-693.2.2.el7.x86_64)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.