compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] 'docker compose watch' regression on Windows containers (v2.24.0 to latest)

Open lavia opened this issue 1 year ago • 1 comments

Description

v2.24.0 introduced a regression in docker compose watch for Windows containers using Hyper-V isolation. The sync action fails with the following error:

Syncing "<service>" after changes were detected:
  - <path>
time="2024-03-04T15:34:00+02:00" level=warning msg="Error handling changed files for service <service>: 1 error occurred:\n\t* copying files to <container id>: Error response from daemon: filesystem operations against a running Hyper-V container are not supported\n\n"

Hyper-V isolation is a requirement for running Windows containers on Windows 10 (see Windows Client host OS compatibility), and the default when using Docker Desktop.

The issue is still present in the latest version of docker-compose, as well as when building docker-compose from the latest commit in main.

I've traced the issue to these commits:

  • 8d81b875130dc294e49be0fc09ac7146208790b4 PR #11330
  • a220043ca0688a4931f76f44fd156935599699de PR #11497

8d81b875130dc294e49be0fc09ac7146208790b4 being the culprit, while a220043ca0688a4931f76f44fd156935599699de simply removes code made unnecessary by the first.

I built docker-compose after reverting these commits, and can confirm that reverting solves the issue.

Expected Behavior

docker compose watch syncs changes to watched files on the host to the running container.

watch enabled
Syncing "<service>" after changes were detected

Notes

I am not familiar with this project, this is a report of an issue that my team has run into.

I also have not tested the following:

  • Using docker compose watch on Windows containers using process isolation, though my guess is this issue is specific to Hyper-V isolation

  • Any action other than sync

Steps To Reproduce

On Windows 10/11 with Docker Desktop (v4.27.0 to v4.28.0) installed, do the following in a directory of your choosing:

  1. Create the following files:

    • dockerfile:

      FROM mcr.microsoft.com/windows/servercore:ltsc2019
      
      ADD test C:\\test
      
      ENTRYPOINT [ "ping", "-t", "localhost" ]
      
    • docker-compose.yml

      services:
        test:
          build: .
          develop:
            watch:
              - action: sync
                path: .\test
                target: C:\test
      
    • test\test.txt

      test
      
  2. Set Docker Desktop to Windows containers mode

  3. Run docker compose watch

  4. Modify test\test.txt to trigger the sync action

Compose Version

Docker Compose version v2.24.6-desktop.1

Docker Environment

Client:
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1-desktop.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.6-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.24
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.22
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.0.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.5.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 4
  Running: 0
  Paused: 0
  Stopped: 4
 Images: 66
 Server Version: 25.0.3
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 19045 (19041.1.amd64fre.vb_release.191206-1406)
 Operating System: Microsoft Windows Version 22H2 (OS Build 19045.4046)
 OSType: windows
 Architecture: x86_64
 CPUs: 4
 Total Memory: 24GiB
 Name: <HOSTNAME>
 ID: 782670a6-94c9-4c37-8cea-1586f46467a0
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

No response

lavia avatar Mar 04 '24 18:03 lavia

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 07 '24 00:08 github-actions[bot]