Unable to run rails server with docker & wsl2

My operating system is Win11, I use docker and wsl2 at the same time, and the code is in the wsl system. When I run rails server I get a docker compose error:

invalid interpolation format for services.web.working_dir: "//wsl$/Ubuntu/data/code/xxx". You may need to escape any $ with another $

 

 

The problem is caused by the docker-compose.override.yml file, which has a line :

working_dir: "//wsl$/Ubuntu/data/code/xxx"

Is there something wrong with my configuration?

 

OS Version: WIN11 21H2 22000.795

WSL2 Version: Ubuntu 20.04.4 LTS

Docker Desktop Version:  4.10.1 (82475)

Rubymine Version: 2022.1.3

 

7 comments
Comment actions Permalink

Hello! The problem seems related to this issue: RUBY-29812. Please upvote it and monitor it for updates. Would it be possible for testing purposes to move the project to Windows FS?

0
Comment actions Permalink

Thanks for the reply, I have solved this problem by adding project path mappings in server configuration, for example

//wsl$/Ubuntu/data/code/xxx=/xxx

And my previous project was in Windows FS, but it ran so slow that it affected the development work, and it was much better after moving to WSL FS.

0
Comment actions Permalink

Sorry for the offtopic, could you tell me more about your configuration. We would use this information to improve RubyMine. If I understand correctly, your project is in WSL2 FS. Where is your Ruby interpreter located? In docker-compose, WSL2 or on Windows host? What are you using docker-compose with WSL2 for?

Maybe you could share your project?

0
Comment actions Permalink

Because our project is not open source so I'm afraid I can't share it with you, but I can tell you some configuration information. Our development platform is Windows, we use WSL2 and Docker Desktop to run the project, the project is in WSL2 FS, and the Ruby interpreter is in a container run by docker compose. The reason why WSL2 is used is because the project runs very slowly in Windows FS, but it will be much faster in WSL2 FS, which is also officially recommended by Docker: https://docs.docker.com/desktop/windows/wsl/#best-practices

0
Comment actions Permalink

Thanks a lot for your answer!

0
Comment actions Permalink

FYI I was running into a similar issue with Docker+WSL2+Win11.
I am new to Docker so I am not sure if I did everything properly, but everything seem to work well if I open the project from the Windows file system or on a Mac (Ruby interpreter is docker-compose in both cases) but getting the "invalid interpolation format for services.web.working_dir" error if I don't add the path mapping in the Run/Debug configuration. If I add it, then I am running into a different error (missing gems, but thez are installed in the container). If I also add the path mapping under Rubz SDK and Gems then I am running into a third error:
rails  | /usr/local/bin/ruby: No such file or directory -- /app/bin/rails (LoadError)

Unfortunately, I can't resolve that last error (FYI the rails service is running without errors if I manually issue "docker compose up" from a WSL terminal).

I have zipped the .idea folder and the docker relevant files if it helps:
https://drive.google.com/file/d/1kQU5bKv72SviLtdwxqFNfiH2pX71q28g/view?usp=sharing

0
Comment actions Permalink

István Ujj-Meszaros, thank you for adding also a comment to the tracker's issue, I'll add here a link so that the other users can check it:

https://youtrack.jetbrains.com/issue/RUBY-29812/-No-SDK-shown-in-Project-settings-under-WSL2DockerDesktopproject-folder-in-WSL

But if your error differs, it'd be great if you could submit a separate issue so that they aren't mixed.

0

Please sign in to leave a comment.