Path issues - Remote Interpreter Docker on remote machine
So my current setup is a linux server and my windows desktop.
Docker is installed on the linux server and I have my image that I want to run/debug in.
I can connect to this via the remote interpreter setup and see that my python libraries are installed and if I set a breakpoint and run/debug, I can see the image get spawned as a container. However, my project files will not transfer into the image. I've tried configuring it at the Project >> Project Interpreter >> Path Mappings screen, both as my windows path and to a folder on the host where I deployed my files to.
Both ways fail saying: python: can't open file 'C:/Users/Jimmy/PycharmProjects/objman_api/venv/objman/app.py': [Errno 2] No such file or directory
If I debug and login to the console of the docker container, the folder IS there, but is empty. I'm at a loss as this is how I need to test and debug my application.
Can anyone direct me to documentation or a tutorial regarding setting this up or tell me if it's simply not possible to do remote interpreter/mounting via pycharm? I could install Linux on my desktop and do my development there, but I was hoping to keep my windows stuff for my more mundane work tasks.
Please sign in to leave a comment.
I've also had the same issue running docker locally on OSX. It doesn't look like there is a way to add to the path mappings for the remote interpreter.
This has been my #1 issue with pycharm since I started using it. With the current setup I don't have intelisense since pycharm can't find my dependencies and I can't set them manually.
I have the same issue, with 2018.3 path mappings of my docker remote interpreter are not added correctly
I have found a way to resolve this problem. Do let me know if it works for you:
Map directory between container and host machine:
Run -> Edit configurations -> Docker container settings -> edit the path for mapping
Then run your code again, the local and docker directory should be synced.
Tuantran this works. But if you have a large project with multiple scripts this needs to be done manually for each script I presume? Is there any way of globally setting the "Edit configurations" mapping to the entire project?
Wow. After reading my own post to make sure it made sense, I saw the path issue.
While the path mapping in Project >> Project Interpreter >> Path Mappings doesn't work from my Windows desktop => Linux Docker Host, I imagine it would work if I were running docker for windows with a host mount or running Linux on my desktop.
For now I have adjusted the path and am using the deploy local option via an NFS mount to the Docker host. With the script path updated, this now works.
I have for example a Use case where i need my container to run on a specific host (Because of network traffic that is routed only there).
The existing setup allows me only to run on the local host.
Instead of mapping the project files DIR to the docker DIR, copying them would solve this.
Please try to configure remote docker according to the following guide: https://youtrack.jetbrains.com/issue/PY-33489
same issue here event with Docker for Mac (local docker):
PHPStorm 2018.3.3
macOS Mojave
Even though I configured the path mappings everywhere correctly, whenever I run codecept or the code sniffer using the remote (docker) interpreter, the path mappings are not added to the docker container created by PHPStorm...
Did anyone solve this?
I ended up buying a Dell T-5600 machine to run things locally. For about $800, you can pick up a 16 Core 128gb RAM machine on newegg. That's my recommendation as opposed to fighting this issue.