How to set pycharm's interpreter to use docker

Viewed 149

I understand the following docker server start allow me to access to the jupyter notebook

docker pull tensorflow/tensorflow:latest-py3  # Download latest stable image
docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter  # Start Jupyter server

My question is how can I change the interpreter inside of the pycharm to use this?

1 Answers

It should be rather straight forward to attach pycharm to the tensorflow/tensorflow:latest-py3 image.

Go to File -> 
Settings -> 
Project -> 
Select interpreter -> 
Click the Gear -> 
Add -> 
Select Docker -> 
Create a unix Socket 
Choose tensorflow/tensorflow:latest-py3 as Image name and your might need to edit the Python interpreter path based on the image.

To get the python path you will need to up a shell or bash via:

docker exec -it container_name sh
docker exec -it container_name bash

To get the container name you can use

docker container ls -a

Finally once in the bash something like this might work

python -c "import sys; print(sys.path)"
Related