Skip to content

[BUG] Very large code changes (e.g. checking out a different branch) cause docker compose up --watch to break #13136

@coredumperror

Description

@coredumperror

Description

I've run into a problem with docker compose up --watch where, if I check out a different branch of my codebase that has a lot of changes compared to the current branch, the watch system will break in a very strange way.

If I see a log message like this, I know the watch is busted:

                  ⦿ Syncing service "multitenant" after 3115 changes were detected

Specifically, the container seemingly stops outputting any logs, though later code changes will still be synced into it and logged. In addition, hitting Ctrl-C to kill the swarm will result in output like this:

^CWARN[14037] Error handling changed files: 1 error occurred:
	* copying files to 6d240aa8b95517098dd76f4510ee2936df3d80500b52fd5bbd04f2395c8f6ef8: Put "http://%2FUsers%2Frrollins%2F.docker%2Frun%2Fdocker.sock/v1.51/containers/6d240aa8b95517098dd76f4510ee2936df3d80500b52fd5bbd04f2395c8f6ef8/archive?copyUIDGID=true&noOverwriteDirNonDir=true&path=%2F": context canceled

Gracefully stopping... (press Ctrl+C again to force)
[+] Stopping 6/6
 ✔ Container multitenant_www     Stopped5.4s
 ✔ Container mail-multitenant    Stopped0.8s
 ✔ Container multitenant         Stopped4.2s
 ✔ Container redis-multitenant   Stopped0.2s
 ✔ Container db-multitenant      Stopped1.7s
 ✔ Container search-multitenant  Stopped0.5s
^C^Cgot 3 SIGTERM/SIGINTs, forcefully exiting

The app will ultimately never close itself gracefully, and requires a repeated Ctrl-C command to make it shut down.

Steps To Reproduce

  1. Run docker compose up --watch.
  2. Check out a different branch of the repo on the host, causing many files to change and need to be synced. It's possible that a rebuild action also needs to be triggered by this, but I'm not certain.
  3. If the bug triggers, Ctrl-C will print an error message about "context canceled", and the docker compose session will never die, even after the swarm is stopped.

Compose Version

Docker Compose version v2.38.2-desktop.1

(Both are the same)

Docker Environment

$ docker info
Client:
 Version:    28.3.2
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.9.9
    Path:     /Users/rrollins/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.25.0-desktop.1
    Path:     /Users/rrollins/.docker/cli-plugins/docker-buildx
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.4.2
    Path:     /Users/rrollins/.docker/cli-plugins/docker-cloud
  compose: Docker Compose (Docker Inc.)
    Version:  v2.38.2-desktop.1
    Path:     /Users/rrollins/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.41
    Path:     /Users/rrollins/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.1.11
    Path:     /Users/rrollins/.docker/cli-plugins/docker-desktop
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.29
    Path:     /Users/rrollins/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/rrollins/.docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.9.9
    Path:     /Users/rrollins/.docker/cli-plugins/docker-mcp
  model: Docker Model Runner (EXPERIMENTAL) (Docker Inc.)
    Version:  v0.1.33
    Path:     /Users/rrollins/.docker/cli-plugins/docker-model
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/rrollins/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.18.2
    Path:     /Users/rrollins/.docker/cli-plugins/docker-scout
WARNING: Plugin "/Users/rrollins/.docker/cli-plugins/docker-dev" is not valid: failed to fetch metadata: fork/exec /Users/rrollins/.docker/cli-plugins/docker-dev: no such file or directory

Server:
 Containers: 6
  Running: 0
  Paused: 0
  Stopped: 6
 Images: 14
 Server Version: 28.3.2
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 12
 Total Memory: 7.653GiB
 Name: docker-desktop
 ID: 42077820-6f80-461d-86a1-c7cb9ef0c903
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/rrollins/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: DOCKER_INSECURE_NO_IPTABLES_RAW is set

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions