Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when mounting host path with Docker for Windows when using different DOCKER_HOST #4240

Closed
giggio opened this issue Dec 12, 2016 · 4 comments

Comments

@giggio
Copy link

giggio commented Dec 12, 2016

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:

    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.

@shin-
Copy link

shin- commented Dec 13, 2016

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?

@giggio
Copy link
Author

giggio commented Dec 14, 2016

@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.

@airtonix
Copy link

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

...
$Env:COMPOSE_CONVERT_WINDOWS_PATHS=1
...

@mattkenefick
Copy link

I also seemingly had success by adding :

COMPOSE_CONVERT_WINDOWS_PATHS=1 to an .env file existing in the same folder as the docker-compose.yml file.

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

No branches or pull requests

4 participants