Skip to content

docker-compose up converts linux path to windows for volumes #8051

@AlekseiPavlov-GC

Description

@AlekseiPavlov-GC

Hi colleagues,

Steps to reproduce

Docker 3.1.0 (51484) running with WSL2 on Windows 10 version 1909.

I try to execute the script using Windows Powershell 7.1:
docker-compose -f "docker-compose.generated.json" up --build --remove-orphans --renew-anon-volumes --force-recreate --always-recreate-deps

The json file has the following section:

"volumes": {
       "inputansibleconfigvolume": {
          "driver_opts": {
             "type": "none",
             "device": "${ANSIBLE_CONFIGS}",
             "o": "bind"
          }
       }
    }

The Environment Variable ANSIBLE_CONFIGS is set to: /c/Dev/Git/folder

When I execute the command:
docker-compose -f "docker-compose.generated.json" up --build --remove-orphans --renew-anon-volumes --force-recreate --always-recreate-deps

A docker volume is created.

Actual:
device: "C:\c\Dev\Git\folder"
Or depending on different manipulations device value can be a slightly different but always in Windows style.

Expected:
device: "/c/Dev/Git/folder"

I tried:
COMPOSE_CONVERT_WINDOWS_PATHS=1
COMPOSE_CONVERT_WINDOWS_PATHS=0

This had no effect.

Workaround:

"volumes": {
       "inputansibleconfigvolume": {
          "external" true
       }
    }

docker volume create --name inputansibleconfigvolume -o type=none -o device=/c/Dev/Git/folder -o o=bind

Could you please check this?

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