Skip to content

[BUG] watch watch's root even if that is not specified #11182

@khalil-omer

Description

@khalil-omer

Description

When running a compose file like the below with docker compose watch in the context of a monorepo, the directory compose is run from is watched as well as the specific subdirectory. The expected behavior is for the path to be honored.

---
version: '3'
services:
  servicea:
    container_name: 'serviceA'
    build: ./apps/servicea
    develop:
      watch:
        - action: rebuild
        - path: ./apps/serviceA
    ports:
      - '4600:4600'

In fact, the output of the watch command includes
watching [/Users/khalil_work/repos/repoName /Users/khalil_work/repos/repoName/apps/serviceA]
which shows that the root is indeed being watched. I would expect only .apps/serviceA to be watched, not the root. Root defeats the purpose because then all containers with a watch config will be rebuilt based on any change in the repository.

The behavior is the same even if running docker compose watch servicea.

Compose Version

2.22

Docker Environment

Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.1
    Path:     /Users/khalil_work/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0
    Path:     /Users/khalil_work/.docker/cli-plugins/docker-compose

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions