I want to know does react the ENTRYPOINT
instruction from Dockerfiles when heritage happens :
Let's say for example I have an image called : jenkins
FROM java:8-jdk
RUN ...
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
By running this image, the ENTRYPOINT
directive will start and install the application as expected
Let's say now that I want to extend this image with a new Dockerfile, I call it : jenkins-custom
FROM jenkins
# enable start tls
RUN echo "JENKINS_JAVA_OPTIONS=\"-Dmail.smtp.starttls.enable=true\"" >> /etc/default/jenkins
RUN chown jenkins:docker /etc/default/jenkins
Should I consider that :
In my example, I am trying to activate STARTTLS in default Jenkins Docker image, should I just restart the process in the second image ?
Docker ENTRYPOINT In Dockerfiles, an ENTRYPOINT instruction is used to set executables that will always run when the container is initiated. Unlike CMD commands, ENTRYPOINT commands cannot be ignored or overridden—even when the container runs with command line arguments stated.
Docker Entrypoint ENTRYPOINT is the other instruction used to configure how the container will run. Just like with CMD, you need to specify a command and parameters. However, in the case of ENTRYPOINT we cannot override the ENTRYPOINT instruction by adding command-line parameters to the `docker run` command.
The main purpose of a CMD is to provide defaults for an executing container. and for ENTRYPOINT : An ENTRYPOINT helps you to configure a container that you can run as an executable.
Docker defaults the entrypoint to /bin/sh -c . This means you'll end up in a shell session when you start the container.
The commands in ENTRYPOINT
run when you execute docker run
. However, commands in RUN
are executed when you run docker build
.
In your case, what's going to happen is that when you docker build
the image, a new Jenkins configuration file is generated, and then when you docker run
it, tini
is launched, and in turns execute the jenkins-entrypoint.sh
.
If what you're trying to do is change the Jenkins configuration and nothing else, what you have here is good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With