0

I have a SOLR image starting with a default configuration when I start my container. I want to change the way SOLR starts in my container by referencing a different configuration file. Of course, I still want to use the original image I had from the beginning.

What is the best practice to do so? If I use a docker file referencing my original image it will start it with the default value as no script has been modified.

I also thought about committing my new configuration file on my image, that works but that still does not change the starting script. Can someone guide me on the best practice to do that? Thanks in advance for your help.

TonyDav
  • 25
  • 4
  • Can you share the Dockerfile of the image which you want to re-use? Also what change you want to do ? – vivekyad4v Jan 18 '18 at 12:16
  • Possible duplicate of [How to extend an existing docker image?](https://stackoverflow.com/questions/22905803/how-to-extend-an-existing-docker-image) – Matt Morgan Jan 18 '18 at 12:19

1 Answers1

3

Startup of a container is always controlled by ENTRYPOINT & CMD. In this case if you want to override it, you can create your own script & define it in the CMD & ENTRYPOINT defines a null environment to execute CMD but moreover, it overwrites your previous ENTRYPOINT in Dockerfile(You can provide a different ENTRYPOINT script as well). You can do it as below in Dockerfile -

FROM solr:latest
...................
...................

COPY your-data /container-data
ENTRYPOINT ["/usr/bin/env"]
CMD /run.sh

You can copy your data inside container using COPY & define operations to be performed in run.sh, run.sh is your own script which you want to get executed on container startup.

vivekyad4v
  • 13,321
  • 4
  • 55
  • 63
  • Sorry for the delay, I was experimenting your proposal but I needed to override a complex script in my container. I can confirm that using CMD worked perfectly fine for me. Thanks a lot for your help – TonyDav Feb 02 '18 at 17:22