Passing arguments to Docker when using remote python interpreter within docker

My setting

 

MacOS, pycharm 2019.3.2.

I have a remote server -- CentOS 7 -- and I want to run docker in the server and use the remote interpreter there. I have followed the guide here: https://youtrack.jetbrains.com/issue/PY-33489 and it works like charm! However, a problem is that I need to pass an argument "--ipc=host" to "docker run" like this: "docker run ... --ipc=host ... "

How would I do this? I've tried: https://www.jetbrains.com/help/pycharm/docker.html#command-line-options but it seems like setting command line options there doesn't help when I want to set command line options when I'm using the interpreter within the docker.

0
4 comments

Dockerfile seems to be working with remote interpreters, so you can use Dockerfile configuration instead of Python configuration, and specify run options there:

0

 

Currently, I have my remote interpreter set up this way. How would use the interpreter in the docker with the option you suggested above?

0

Basically when you run this configuration, PyCharm spins up the container, mounts your local project to directory inside the container, and executes the script using remote command.

You can do the same using Dockerfile: https://docs.docker.com/engine/reference/builder/ 

1. Create a Dockerfile with instruction to COPY the script to a WORKDIR inside container, install dependencies if necessary and run the copied script with CMD instruction

2. When you run this Dockerfile in PyCharm, it will build the image on your remote host and run it there, providing output in your local instance of PyCharm.

0

Hi, did you have any luck with this. I am also going to the same path but a bit lost.

0

Please sign in to leave a comment.