简体   繁体   English

Docker-compose 在 WSL 上使用不正确的路径:\\\\?\\C:\\

[英]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.我已经在这个问题上苦苦挣扎了一天多,尽管在 SO 和其他地方也有类似的问题,但没有一个真正符合我的问题,也没有解决它。 For context, I have no problems using docker , only docker compose .对于上下文,我使用docker没有问题,只有docker compose

I'm working on an older project that uses docker compose, in a WSL environment.我正在 WSL 环境中处理一个使用 docker compose 的旧项目。 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.其他有类似问题的路径从/mnt/c ,这可以通过将/c挂载到该目录来解决。 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 .我也看到提到docker engine use wsl ,但docker engine use wsl docker engine check没有显示wsl ,只有一个叫做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.我已经按照本文中的步骤让 WSL 使用 Docker for Windows,我在类似的问题中看到过与 OP 之前所做的类似的问题,或者作为解决问题的建议。

So, a couple of questions:所以,有几个问题:

  • Does anyone know why Docker compose is trying to use such a strange path?有谁知道为什么 Docker compose 试图使用这么奇怪的路径?
  • How can I fix this path?我该如何修复这条路径?

I believe you ran into https://github.com/docker/compose/issues/7101我相信你遇到了https://github.com/docker/compose/issues/7101

Apparently by calling docker-compose I was calling Docker for Windows' docker compose, which uses windows' python.显然,通过调用 docker-compose 我正在调用 Docker for Windows 的 docker compose,它使用 Windows 的 python。 Python's sys.platform is 'win32' (of course), and that was causing docker compose to add that prefix to my context. Python 的 sys.platform 是“win32”(当然),这导致 docker compose 将该前缀添加到我的上下文中。 WSL's docker-compose calls the correct python, which returns sys.platform as linux. WSL 的 docker-compose 调用正确的 python,它返回 sys.platform 作为 linux。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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