Compose: Error when mounting host path with Docker for Windows when using different DOCKER_HOST

Created on 12 Dec 2016  ·  3Comments  ·  Source: docker/compose

When using a different DOCKER_HOST, unless you set COMPOSE_CONVERT_WINDOWS_PATHS=0, any mount you specify on your docker-compose file will fail with:

ERROR: for db Cannot create container for service db: create <volume>: "<volume>" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed ERROR: Encountered errors while bringing up the project.

This is really confusing. This used to work fine before.
I am on 1.9.0 build 2585387.
DOCKER_HOST is set to a remote linux server.
Volumes is:

yml volumes: - /opt/data/foo/html/:/var/www/html

Only works when COMPOSE_CONVERT_WINDOWS_PATHS=0 is set or when it is set to COMPOSE_CONVERT_WINDOWS_PATHS=1. In other words, it only fails if COMPOSE_CONVERT_WINDOWS_PATHS is unset.

On the 1.9.0 release you mention that:

When using Compose with Docker Toolbox/Machine on Windows, volume paths are no longer converted from C:\Users to /c/Users-style by default. To re-enable this conversion so that your volumes keep working, set the environment variable COMPOSE_CONVERT_WINDOWS_PATHS=1. Users of Docker for Windows are not affected and do not need to set the variable.

The last part Users of Docker for Windows are not affected and do not need to set the variable is not true.


Most helpful comment

Looks like we have to set this in our ~/Documents/WindowsPowershell/Microsoft.PowerShell_profile.ps1


All 3 comments

Thank you for the report.

Is your DOCKER_HOST pointing to a remote Linux server?
And when you see the error, is your COMPOSE_CONVERT_WINDOWS_PATHS variable unset, or what value is it set to?
Finally, what happens when you set COMPOSE_CONVERT_WINDOWS_PATHS to 1 instead?

@shin- Yes, DOCKER_HOST is pointing to a remote Linux server.
The error happens when COMPOSE_CONVERT_WINDOWS_PATHS is unset. When I set it to COMPOSE_CONVERT_WINDOWS_PATHS=0 (in powershell $env:COMPOSE_CONVERT_WINDOWS_PATHS=0), then it works.
I hadn't tried before, but COMPOSE_CONVERT_WINDOWS_PATHS=1 also works. Go figure...
So, summarizing, it only fails when COMPOSE_CONVERT_WINDOWS_PATHS is unset. I will update the issue description.

Looks like we have to set this in our ~/Documents/WindowsPowershell/Microsoft.PowerShell_profile.ps1

Was this page helpful?
0 / 5 - 0 ratings