How to change docker mapped path for docker interpreter in pycharm ?

By default, project path is mapped to `/opt/project`, may I know if there's way to change it ? Things tried

 

1. update container settings in run configurations to add another -v host_path:container_path, not working

2. try to add a path mapping in docker deployment, not working.

 

Advice is highly appreciated.

 

Thanks !

8 comments
Comment actions Permalink

>update container settings in run configurations to add another -v host_path:container_path, not working

Why add another? Have you tried to simply change the existing mapping entry? 

0
Comment actions Permalink

I tried, but it doesn't work. I also tried to add another mapping from the ui you show, it didn't work either. I am on pycharm 2019.3 professional edition

0
Comment actions Permalink

>I also tried to add another mapping from the ui you show, it didn't work either

Works on my side. Can you please show a screenshot of your run/debug configuration and copy-paste the output of the run console when you run that configuration? E.g., assuming I've changed from /opt/project to /tmp/foo, then it should say:

391e018e01a8:python -u /tmp/foo/app.py

0
Comment actions Permalink

I guess it is because I ticked Run with Python Console Without enabling it, it works fine.

This is python console output.

 

This is my configuration. W

 

0
Comment actions Permalink

This is the output without enabling python console.

101acd48f9f1:python -u /somepath/test.py


/somepath

 

testing docker file

 

 

 

 

 

```

FROM python:3

```

 

testing script

```

import os
print(os.getcwd())

```

0
Comment actions Permalink

when enabling python console, I can get it to work by changing configurations.

 

and the console looks normal

 

but volume mount seems to be wrong

0
Comment actions Permalink

Since you're running with python console, have you tried changing mappins in [File | Settings | Build, Execution, Deployment | Console | Python Console] settings? 

You should specify path mapping and the working directory there, then it should work.

0
Comment actions Permalink

I tried

docker path mapping

-v /Users/user/Desktop/code/demo:/workspace

 

python interpreter mapping

/Users/user/Desktop/code/demo=/workspace

working directory: /workspace

 

Can you be more specific on configuring it ? thanks ! 

 

it doesn't work.

 

/workspace is still not mounted

0

Please sign in to leave a comment.