← All notes

docker compose watch syncs, rebuilds or restarts services when source files change

Answer: Add a develop.watch list to a service and run docker compose watch (or docker compose up --watch). Each rule names a path and an action: sync, rebuild or sync+restart. The develop section is available with Docker Compose version 2.22.0 and later.

Example

services:
  web:
    build: .
    develop:
      watch:
        - action: sync
          path: ./web
          target: /src/web
          ignore:
            - node_modules/
        - action: rebuild
          path: package.json

Actions

Path rules

The container user must be able to write to the target path so it can update files.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs (Compose how-tos), Use Compose Watch; Docker docs (reference), Compose Develop Specification. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker docs (Compose how-tos), Use Compose Watch; Docker docs (reference), Compose Develop Specification. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.

Cite this

Permanent ID: iil:note:3mrb3dgb

iinventedlight. 2026. "docker compose watch syncs, rebuilds or restarts services when source files change." iinventedlight Library, iil:note:3mrb3dgb, version of 2026-11-18. https://iinventedlight.com/library/notes/docker-compose-watch/. License: CC-BY-4.0.

@misc{iil_note_3mrb3dgb,
  author = {{iinventedlight}},
  title = {{docker compose watch syncs, rebuilds or restarts services when source files change}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/docker-compose-watch/},
  note = {Permanent ID iil:note:3mrb3dgb. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-compose-watch.md.