简体   繁体   中英

Auto rebuild docker container after code change

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?

Is there an option to force docker-compose to rebuild and to run the container after any code change?

Docker doesn't have option to perform a watch files-rebuild process.

If it isn't possible, is there a workaround for that case?

For applications running on Docker in a local environment, to achieve such a thing, I generally avoid full-packaging the applications.
Instead, I rely on the dev mode abilities of the applicative libraries/frameworks that I use.

The idea is to do a bind mount of the source code located in the host and to take advantage of auto-hot deploy feature provided by the dev mode of the libraries/frameworks that I use.
Nowadays, modern libraries/frameworks provide a dev mode for that.
For example Spring Boot applications allow that with the maven plugin (mvn spring-boot:run ) and the devtools dependency, Angular applications allow that with ng serve , ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM