简体   繁体   中英

Docker-compose on WSL using incorrect path: \\?\C:\

I've been struggling with this issue for over a day now, and although there are similar questions here on SO and on other places, none really match my problem, or solve it. For context, I have no problems using docker , only docker compose .

I'm working on an older project that uses docker compose, in a WSL environment. When I run:

docker-compose -f /srv/etc/docker/docker-compose.yml -f /srv/etc/docker/docker-compose.prod.yml up --build

I get the following error:

OSError: Can not read file in context: \\?\C:\Users\<path>\venv\bin\python

Others with similar problems had their path start at /mnt/c , which can be solved by mounting /c to that directory. However, my incorrect path doesn't match others I have seen on similar questions.

Regardless, I tried the mounting solution and it didn't change my problem.

I have also seen mentions of docker engine use wsl , but docker engine check doesn't show a wsl one, only one called current .

I have followed the steps on this article to have WSL use Docker for Windows, which I have seen mentioned in similar questions as something the OP did previously, or as a suggestion to fix the problem.

So, a couple of questions:

  • Does anyone know why Docker compose is trying to use such a strange path?
  • How can I fix this path?

I believe you ran into https://github.com/docker/compose/issues/7101

Apparently by calling docker-compose I was calling Docker for Windows' docker compose, which uses windows' python. Python's sys.platform is 'win32' (of course), and that was causing docker compose to add that prefix to my context. WSL's docker-compose calls the correct python, which returns sys.platform as linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM