Skip to content

[BUG] Bind mounts not working when using DOCKER_HOST variable for Windows Containers #12750

Closed

Description

@0xff8

Description

I am trying to start windows containers using docker compose from linux host on remote windows machine using SSH. When I run docker compose up command , remote windows host fails to run containers, since the local current path gets prepended to the volume.

Error response from daemon: invalid mount config for type "bind": invalid mount path: '/builds/projects/windows-docker/C:\Users\test-user\results' mount path must be absolute

What I have tried so far:

  • added platform: windows/amd64 to docker-compose.yaml
  • added export DOCKER_DEFAULT_PLATFORM=windows/amd64
  • Tried Unix-like path //C/Users//results (not working, although compose client stops adding current path to the volume name)
  • Tried to add a slash in front of the path /C:\Users<YourUserName>\results (not working, remote windows machine complains that the path must be absolute)

Steps To Reproduce

  1. Set DOCKER_HOST variable to ssh://user@windows-host/
  2. From linux host run docker compose up
  3. compose.yaml:
services:
  node:
    platform: windows/amd64
    image: ${IMAGE}
    volumes:
      - type: bind
        source: C:\Users\<YourUserName>\results
        target: C:\Results
    restart: unless-stopped
    stdin_open: true
    tty: true

Compose Version

Docker Compose version v2.35.0

Docker Environment

Server: Docker Engine - Community
 Engine:
  Version:          28.0.1
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.23.6
  Git commit:       bbd0a17
  Built:            Wed Feb 26 10:40:47 2025
  OS/Arch:          windows/amd64
  Experimental:     false

Anything else?

If possible - suggest some hack / other method

Activity

  1. fabiang commented on Apr 17, 2025

    @fabiang

    Yes this is a regression which was probably introduced with #12725. Also Named Pipe mounts do not work as before:

    validating docker-compose.yml: services.node.volumes.1.type services.node.volumes.1.type must be one of the following: "bind", "volume", "tmpfs", "cluster", "image"

    My Compose file:

    services:
      node:
        image: jenkins/inbound-agent:${AGENT_VERSION_WINDOWS:-windowsservercore-ltsc2022}
        volumes:
          - type: npipe
            source: '\\.\pipe\docker_engine'
            target: '\\.\pipe\docker_engine'

    I downgraded to Docker Compose version v2.31.0 (last stable Alpine version) and it's working again (previously I had the packages from "edge" installed).

  2. perosb commented on Apr 18, 2025

    @perosb

    Same here with npipe.
    2.35.0 breaks npipe which works fine in 2.34.0

  3. ndeloof commented on Apr 26, 2025

    @ndeloof
    Contributor

    named pipe support has been restored by compose-spec/compose-go#771

    original issue is that compose doesn't guess a Windows source path is absolute when running on Linux. This is a pretty uncommon scenario, actually codebase tries to detect the opposite: target unix absolute path when running on Windows, which is a common case (Docker Desktop Windows), see https://github.com/compose-spec/compose-go/blob/ca961cc58145b2b1b8221f2a0c4e9734772156fc/paths/unix.go#L26

  4. 0xff8 commented on Apr 28, 2025

    @0xff8
    Author

    Hi @ndeloof ,

    Thanks for the help!
    Do you think instead of guessing, it is possible to rely on platform: field inside of the service description? This seems very logical to me. If a user explicitly defines the platform as windows/amd64 , then windows path can be expected, and if it is not windows - then there is no need to check for windows paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions