Description
Wanted to play with the new docker compose alpha watch, however it seems to restart all my services while I only added x-watch directive to one of them.
Steps To Reproduce
- Tried with the latest version installed manually
docker compose version
Docker Compose version v2.17.3
compose.yaml, Dockerfile & entrypoint.sh
services:
a:
build:
context: .
x-develop:
watch:
- action: rebuild
path: hello.txt
b:
build:
context: .
c:
build:
context: .
FROM alpine:latest
WORKDIR /app
COPY entrypoint.sh .
COPY hello.txt .
STOPSIGNAL 9
ENTRYPOINT ["sh", "-c", "/app/entrypoint.sh"]
DATE=`date`
while true
do
echo $DATE `cat hello.txt`
sleep 1
done
- Starting up the stack & the watch
compose-watch-test-a-1 | Fri May 26 15:36:21 UTC 2023 hello
compose-watch-test-b-1 | Fri May 26 15:36:21 UTC 2023 hello
compose-watch-test-c-1 | Fri May 26 15:36:21 UTC 2023 hello
compose-watch-test-a-1 | Fri May 26 15:36:21 UTC 2023 hello
compose-watch-test-c-1 | Fri May 26 15:36:21 UTC 2023 hello
compose-watch-test-b-1 | Fri May 26 15:36:21 UTC 2023 hello
docker compose alpha watch
watch command is EXPERIMENTAL
watching /Users/maxcleme/workspace/maxcleme/compose-watch-test
watching /Users/maxcleme/workspace/maxcleme/compose-watch-test
watching /Users/maxcleme/workspace/maxcleme/compose-watch-test
- Editing
hello.txt
Rebuild is indeed triggered, but all my services got replaced
compose-watch-test-a-1 | Fri May 26 15:43:20 UTC 2023 world
compose-watch-test-c-1 | Fri May 26 15:43:20 UTC 2023 world
compose-watch-test-b-1 | Fri May 26 15:43:20 UTC 2023 world
compose-watch-test-a-1 | Fri May 26 15:43:20 UTC 2023 world
compose-watch-test-c-1 | Fri May 26 15:43:20 UTC 2023 world
Compose Version
Docker Compose version v2.17.3
Docker Environment
Client:
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.10.4
Path: /Users/maxcleme/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.17.3
Path: /Users/maxcleme/.docker/cli-plugins/docker-compose
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: /Users/maxcleme/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.19
Path: /Users/maxcleme/.docker/cli-plugins/docker-extension
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v0.1.0-beta.4
Path: /Users/maxcleme/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/maxcleme/.docker/cli-plugins/docker-sbom
scan: Docker Scan (Docker Inc.)
Version: v0.26.0
Path: /Users/maxcleme/.docker/cli-plugins/docker-scan
scout: Command line tool for Docker Scout (Docker Inc.)
Version: v0.10.0
Path: /Users/maxcleme/.docker/cli-plugins/docker-scout
Anything else?
Also occurring with the latest ref here after make install
docker compose version
Docker Compose version v2.18.1-20-g6f6e1635
BTW, is there any way of toggling "watch" from docker compose up directly? Or do we have to wait until GA 😅 ?
Description
Wanted to play with the new
docker compose alpha watch, however it seems to restart all my services while I only addedx-watchdirective to one of them.Steps To Reproduce
compose.yaml,Dockerfile&entrypoint.shhello.txtRebuild is indeed triggered, but all my services got replaced
Compose Version
Docker Environment
Anything else?
Also occurring with the latest ref here after
make installBTW, is there any way of toggling "watch" from
docker compose updirectly? Or do we have to wait until GA 😅 ?