1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I figured it out eventually, but this was exactly the problem.
@Tuma How did you fix the problem?
Hi @MoA. The github issue that is linked was opened by me. I don't remember the exact commands, but I remember that I had to install Docker for Windows and on WSL via apt install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.