I try to add some service startup to Dockerfile ENTRYPOINT.
But Jenkins starts container with `cat` CMD and immediately check `cat` in `docker ps` output. As result, there are race condition between `docker ps` and ENTRYPOINT script.
I created minimalistic example for reproducing this issue on stock Jenkins: https://github.com/bozaro/jenkins-docker-issue
This example contains:
- Dockerfile declaring ENTRYPOINT:
- ENTRYPOINT script with 3 seconds delay and creating marker file:
- Jenkinsfile running container with marker file check:
Expected result for Jenkins test:
- At least a 3-second delay on pipeline withDockerContainer step
- ENTRYPOINT script output in build output;
- Green build
Actual result for Jenkins test:
- False positive error message:
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, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements).
- Failed "Check file" step because ENTRYPOINT is not completed yet and /tmp/ready file is not exists;
- There are no ENTRYPOINT script output in build.
Theoretically this issue can be solved if Jenkins would send some random string marker to docker container and wait this marker in container output.