I'm using a remote workstation (Ubunutu 18.04) with a GPU via Docker Machine. With PyCharm Professional 2018.1.4 I can connect remotely to the workstation and create/start containers, connect to them and attach a terminal.
The problem occurs when I try to run a python script via docker compose with PyCharm. I get the error:
python: can't open file '/opt/project/testing.py': [Errno 2] No such file or directory
I have the following docker-compose file:
version: '3'
services:
densepose:
build: Dockerfile
image: densepose
volumes:
- ./:/opt/project # I have tried adding and removing this to no avail
- ./included_files:/included_files
- ./output:/output
And I am using the Dockerfile from here
I have tried using both Ubuntu 17.10 and Windows 10 with PyCharm to connect to the remote station to do this but I receive the same error.
Edit:
After more digging it seems to be related to PyCharm copying files pr-emptively to the remote docker-machine. It should be using docker-machine scp but I'm not sure yet.
PyCharm integration with Docker allows you to run your applications in the variously configured development environments deployed in Docker containers.
Connect to a remote server and open the remote project Ensure you have the Remote Development Gateway plugin enabled. On the PyCharm welcome screen, select Remote Development. In the Run the IDE Remotely section, click SSH Connection.
In the Services tool window, select the Images node. Select the Docker registry and specify the repository and tag (name and version of the image, for example, tomcat:latest . Press Ctrl+Enter to run docker pull. Specify the image as in the Docker CLI, for example: ubuntu:20.04 .
Paths mappings don't deploy your files to the remote server. You need to create a remote server configuration and upload your files to the remote machine.
Pycharm has a tool for deployment as described here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With