Docker run script in host on docker-compose up
I just wish to know the best practices and examples of how to run a script on HOST from INSIDE a CONTAINER, so that the deploy can be as easy for the installing operator to just run docker-compose up
It seems that there is no best practice that can be applied to your case. A workaround proposed here: How to run shell script on host from docker container? is to use a client/server
trick.
- The host should run a small server (choose a port and specify a request type that you should be waiting for)
- The container, after it starts, should send this request to that server
- The host should then run the script / trigger the changes you want
This is something that might have serious security issues, so use at your own risk.