Just discovered Docker Compose has a native
--watch
flag that replaces manual --reload
setups and bind mounts for dev environments.Add a
develop.watch
section to your service:sync+restart
: sync files and restart containerrebuild
: rebuild image when config files change
Start with
docker compose up --watch
and your containers automatically react to code changes. No more custom dev scripts!services:
app:
build: .
develop:
watch:
- action: sync+restart
path: ./src
target: /app/src
- action: rebuild
path: ./package.json