Ronaldo Lanhellas
Ronaldo Lanhellas

Reputation: 3356

Avoid override ENTRYPOINT base docker image

I have a base docker image pointing to daggerok/jboss-eap-7.1:7.1.0-alpine and it execute a ENTRYPOINT that i don't want to override. But i also need execute another command after base image execute theirs, so my Dockerfile looks like it:

FROM daggerok/jboss-eap-7.1:7.1.0-alpine

#SOME CODE HERE

ENTRYPOINT ["mybash.sh"]

I think this code override ENTRYPOINT in base image, and i need avoid it. My script need to be executed after all commands in base image.

Any tips to solve it ?

Upvotes: 1

Views: 2638

Answers (1)

Fabian Braun
Fabian Braun

Reputation: 3940

There are some problems to achieve what you want:

  • You cannot find out the ENTRYPOINT of the base image at runtime within a .sh-script, so you cannot execute it, without copying it explicitly into your mybash.sh
  • The ENTRYPOINT of the base image you mention is /bin/bash ${JBOSS_HOME}/bin/standalone.sh which launches the main process with id 1 of your docker container. You should not alter that and start this in background for example. Read further here.

I would advise to rewrite mybash.sh: First execute whatever you would like before starting jboss. Then, finish your script with a last line starting jboss: exec "/bin/bash ${JBOSS_HOME}/bin/standalone.sh" (adapted from here)

Upvotes: 1

Related Questions