I am successfully using docker slaves with custom images using the Attach method. The images are not based on jenkins/jnlp-slave but do have java. They have CMD set to ["/bin/sh", "-c"] and ENTRYPOIINT is null.
I've attempted to switch to the JNLP method and cannot get it to work despite spending many hours trying all sorts of combinations. According to the inline help, I should be able to pass a command in the "EntryPoint Arguments" field. I've tried the command suggested there:
as well as a dozen others. The above doesn't work with openjdk:8-jdk image or any others I've tried.
I've also built images with slave.jar and /usr/local/bin/jenkins-agent scripts taken from jenkins/jnlp-slave, and even that doesn't work. No matter what I enter in the field, I always get the following error:
I can run the above manually just fine via docker run:
Of course manually the secrets are wrong, but I can create a slave entry manually via the UI and then my docker container started this way actually connects to jenkins.
From what I can tell, only images that have the ENTRYPOINT set up exactly like jenkins/jnlp-slave can be used with JNLP this way. My conclusion is that the inline help is wrong:
- Either the ENTRYPOINT cannot be overridden here
- Or there is a bug
- Also, Quoting is missing on the example sh -c command (should be sh -c "xxxx")