Skip to main content Run script automatically after Docker container startup : r/docker

Run script automatically after Docker container startup

Until now to automatically execute a script when starting the Docker container I always added at the end of my dockerfile a line with the command to run the script: CMD [myscript].

My problem is that for each new container I have to build a new image with the new script to run, while the dockerfiles are more or less the same (except the last line where I launch the script).

What can I do to avoid creating so many clone images just because I want to run a different script in each container?

Thanks for the help.

that literally led me here....

search bing for google!

More replies