Docker run script in host on docker-compose up

前端 未结 3 1780
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-08 01:22

thank you for watching this question.

So my question relates to best practices on how to run a script on a docker-compose up directive.

Currently i\'m sharin

3条回答
  •  心在旅途
    2021-01-08 01:48

    You can create an alias for docker-compose up. Put something like this in ~/.bash_aliases (in Ubuntu):

    alias up="docker-compose up; ~/your_script.sh"
    

    I'm not sure if running scripts on the host from a container is possible, but if it's possible, it's a severe security flaw. Containers should be isolated, that's the point of using containers.

提交回复
热议问题