JerryMungo
Honorary Master
- Joined
- Jul 18, 2008
- Messages
- 37,540
- Reaction score
- 6,279
.
Last edited:
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Why?Is it possible to mount docker-entrypoint.sh as a bind volume to a file on the host file system to allow dynamic updates to the docker-entrypoint.sh file?
docker run --entrypoint='' someimage 'command you want to execute within container'
Great, that entrypoint parameter, does it point to a file on the host or in the container?
Great, that entrypoint parameter, does it point to a file on the host or in the container?
I'm assuming a file on the container that I can then map to a file on the host.
I think the entrypoint exists in the container if I'm not mistaken. It should be baked into the image.
It's useful for setting up the environment, e.g. I can deploy an updated tomcat .war from my host whenever the container starts up. I can poll the database container and keep polling it until it's up before I launch tomcat, etc.
Kind of yes, but its built by a third party.
Thanks, what I'm trying to achieve is be able to automate the startup of the container, modify the environment, etc. and perform tasks before the main executable is launched... I want to be able to change that start up on the fly without making changes to the container that require commits and redeployment of containers.
if [ "$DOTASK1" == "1" ]
then
echo "performing task1"
fi
if [ "$DOTASK2" == "1" ]
then
echo "performing task2"
fi
...
echo "continue with tasks that will always execute ...."
Then I would recommend building your own image, baking your custom entrypoint script into the image at build time, which accepts parameters (something like what @dadecoza mentioned above) and using that custom image, as opposed to continuing to use the untouched upstream image.I think the main thing is that I don't like the default entry-point that comes with the image so I want to use my own without having to push changes to the container / image every time I deploy an image update if that makes sense.
The image is basically a postgis enabled postgresql server.
docker run -v /home/daruk/scripts:/scripts --entrypoint='/scripts/docker-entrypoint.sh' imagename
That's pretty much what I'm going to try, thanks for the input. That will allow me to update the script and not have to keep applying it to the updated image when the Dev releases it.
Any reason you don't like it?