Skip to content

[JENKINS-73979] Docker entrypoint race condition #722

@jenkins-infra-bot

Description

@jenkins-infra-bot

We run our jenkins agent dockerized, and enabled docker in docker in the jenkins agent.

Our pipeline uses an image, which has included different binaries for building code.

In our image we use
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/bin/bash"]
 
and in the entrypoint.sh we basically use -e variable to determine what to set up for the pipeline.
 
I found that first of all the error came up after docker top

$ docker top 3cd0fbfadba4678ef071da8b33473f34e9fc815d745179f812f6f5eb11b0065b -eo pid,comm
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 

but this is not too bad. I don't think it hurts the run badly.
 
However, I do find anomaly, that perhaps entrypoint.sh has not yet finished, and when I check on the version of my build runtime, it's on a wrong version (not really following what I pass in for the docker run, so I suspect entrypoint.sh has not yet completed).
 
The docker declaration is just a simple:
 

agent {
   docker {
      image "image:version"
      args  "-e RUNTIME_VERSION=12"
   {
}


  

If at the steps {} I put in a sleep 3, then the version will be fetched out correctly (assuming entrypoint.sh has completed running).
 
I looked through a few tickets, and what I think is:
1. We are in dind situation, so I think the error from docker top is acceptable, and it does not really hurt the flow
2. I suspect entrypoint.sh has not yet completed
 
Has anyone got similar situations? Any methods you tried?
 


Originally reported by hchiang, imported from: Docker entrypoint race condition
  • status: Open
  • priority: Major
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-07
Raw content of original issue

We run our jenkins agent dockerized, and enabled docker in docker in the jenkins agent.

Our pipeline uses an image, which has included different binaries for building code.

In our image we use ENTRYPOINT ["/entrypoint.sh"] CMD ["/bin/bash"]   and in the entrypoint.sh we basically use -e variable to determine what to set up for the pipeline.   I found that first of all the error came up after docker top

$ docker top 3cd0fbfadba4678ef071da8b33473f34e9fc815d745179f812f6f5eb11b0065b -eo pid,comm
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 

but this is not too bad. I don't think it hurts the run badly.   However, I do find anomaly, that perhaps entrypoint.sh has not yet finished, and when I check on the version of my build runtime, it's on a wrong version (not really following what I pass in for the docker run, so I suspect entrypoint.sh has not yet completed).   The docker declaration is just a simple:  

agent {
   docker {
      image "image:version"
      args  "-e RUNTIME_VERSION=12"
   {
}

 

If at the steps {} I put in a sleep 3, then the version will be fetched out correctly (assuming entrypoint.sh has completed running).   I looked through a few tickets, and what I think is: 1. We are in dind situation, so I think the error from docker top is acceptable, and it does not really hurt the flow 2. I suspect entrypoint.sh has not yet completed   Has anyone got similar situations? Any methods you tried?  

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions