Customize entrypoint on CJE Agent Docker images

Issue

  • We need to overwrite the ENTRYPOINT of our CJE Agent Docker images.

Environment

Resolution

With the following Dockerfile and entrypoint.sh. The slave starts successfully and the entrypoint is executed, allowing any required customization.

Dockerfile

FROM java:latest
ADD 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:
[x] Use custom docker command shell
Custom docker command shell: ‘dummy’ (the plugin validates this is not blank).

Customizing Build Environments

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.