Issue
- We need to overwrite the ENTRYPOINT of our CJE Agent Docker images.
Environment
- CloudBees Jenkins Enterprise (CJE) - AWS/OpenStack/Anywhere
- CloudBees Jenkins Enterprise - Managed Master (CJE-MM)
- CloudBees Jenkins Enterprise - Operations Center (CJE-OC)
Resolution
With the following Dockerfile and entrypoint.sh. The agent starts successfully, and the entrypoint is executed, allowing any required customization.
Dockerfile
FROM openjdk:latest
ADD entrypoint.sh .
RUN chmod ugo+rwx /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh
#!/bin/bash
if [ $# -gt 0 ]
then
# first argument is the custom docker command shell provided by plugin
# second argument is the java command line generated by the plugin (passed as a single arg)
shift
exec /bin/sh -c "$@"
fi
Then in the Docker Agent Template configuration:
Customizing Build Environments
1 Comments