Skip to content

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

@0xff8

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

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