I’m trying to build a Docker image of Jenkins with a pre-defined list of plugins. However, I’m encountering an error during the build process.
Here’s my Dockerfile:
# Use the official Jenkins image as the base
FROM jenkins/jenkins:lts
# Install plugins using the plugin installation tool
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --plugins -f /usr/share/jenkins/ref/plugins.txt
When I run docker build, I get the following error:
=> ERROR [ 3/21] RUN jenkins-plugin-cli --plugins -f /usr/share/jenkins/ref/plugins.txt 0.3s
------
> [ 3/21] RUN jenkins-plugin-cli --plugins -f /usr/share/jenkins/ref/plugins.txt:
0.246 /bin/sh: 1: jenkins-plugin-cli: not found
------
Dockerfile:6
--------------------
4 | # Install plugins using the plugin installation tool
5 | COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
6 | >>> RUN jenkins-plugin-cli --plugins -f /usr/share/jenkins/ref/plugins.txt
7 |
8 |
--------------------
ERROR: failed to solve: process "/bin/sh -c jenkins-plugin-cli --plugins -f /usr/share/jenkins/ref/plugins.txt" did not complete successfully: exit code: 127
It seems that jenkins-plugin-cli is not found within the Docker image. Any ideas on how to resolve this issue?