PyCharm Docker Remote Interpreter: Choosing an image from a private repository

24 views Asked by At

Problem description

Setup

  1. A remote Ubuntu VM that has docker installed.
  2. A personal computer running PyCharm. PyCharm has remote Docker configurations with SSH authentication, and I've also specified my docker hub credentials in the PyCharm Docker registry. PyCharm also has an SSH connection and deployment configurations to the remote Ubuntu VM above.
  3. A private docker repository in docker hub.

Problem description

Following the relevant JetBrains docs, I am able to set up the remote Docker interpreter with images from public Docker repos. However, I cannot get it to work with images from private Docker repos.

Steps to reproduce the issue

Step 1

After connecting to the remote VM from my setup and the same user defined in the PyCharm SSH, I log in to my docker hub via docker login.

Step 2

I try to configure the new remote docker interpreter: After choosing the relevant docker configuration and specifying my private docker hub repo name, <private-docker-repository-name>, I get the following error:

Connecting to Docker daemon…Connected
Waiting for pull operation…
Error response from daemon: pull access denied for <private-docker-repository-name>, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Pull completed

Launching introspection container…
Done, container launched: bad770c236c1
#/usr/bin/which python3
/usr/bin/python3
Process finished with exit code 0
Introspecting image environment variables…
Done, 3 variables found in the inspect results
Introspecting $HOME: not found
#pwd
/
Process finished with exit code 0
Introspection completed
Removing introspection container

Even though an error occurred, I can continue to the next screen. Notice that it also correctly identified the location of the Python executable using which python.

Step 3

In the last step of the configuration, I should specify the Python executable path for either one of the following environments:virtualenv, system, or conda. After I choose either virtualenv or virtualenv and specify the correct path from the docker image, I get the following error:

Python interpreter process exited with a non-zero exit code -1    Python 3.10.12

And that's it.

Conclusion

I see two problems here:

  1. I can't add images from private repos to PyCharm as remote interpreters.
  2. Even though I used docker login in step 1 of the above process via direct SSH to the remote VM, it seems this authentication does not persistent in my PyCharm SSH connection, even though both SSH to the same VM and user.
0

There are 0 answers