2

I'm running two containers using docker-compose. Is there an option to force docker-compose to rebuild and to run the container after any code change? If so, I would like to get an example. If it isn't possible, is there a workaround for that case?

5
  • Just docker-compose down, docker rmi <image>, docker-compose up when a code change happens (assuming the docker-compose also builds the image if needed)?
    – xenoid
    Commented Mar 10, 2020 at 10:05
  • Yeah, I know that. I need to do automation for this process.
    – Omri
    Commented Mar 10, 2020 at 10:40
  • 1
    How do you detect a code change? If you code is kept with Git, there are Git hooks.
    – xenoid
    Commented Mar 10, 2020 at 10:50
  • Detect the change the change in some way and run the mentioned commands. The easiest example you know you changed the code and just run those commands.
    – Seth
    Commented Mar 10, 2020 at 10:56
  • So actually i need to write an external script? Is it the only option?
    – Omri
    Commented Mar 10, 2020 at 11:54

0

You must log in to answer this question.

Browse other questions tagged .