PyCharm配置远程Docker解释器:私有仓库镜像拉取失败问题
问题描述
环境配置
- 已安装Docker的远程Ubuntu虚拟机
- 运行PyCharm的个人电脑:已配置基于SSH认证的远程Docker连接,在PyCharm Docker注册表中填写了Docker Hub凭据,同时配置了到上述远程Ubuntu虚拟机的SSH连接与部署项
- Docker Hub中的私有Docker仓库
问题详情
按照JetBrains官方文档,我可以成功配置基于公开Docker仓库镜像的远程Docker解释器,但无法使用私有Docker仓库的镜像完成配置。
复现步骤
步骤1
通过SSH连接到远程虚拟机(使用与PyCharm SSH配置相同的用户),执行docker login登录Docker Hub。
步骤2
尝试配置新的远程Docker解释器:选择对应Docker配置并指定私有Docker仓库名称<private-docker-repository-name>后,出现以下错误:
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
尽管出现错误,仍可进入下一步,且系统已通过which python3正确识别Python可执行文件位置。
步骤3
在配置的最后一步,需为virtualenv、system或conda环境指定Python可执行文件路径。选择virtualenv并填写镜像中的正确路径后,出现以下错误:
Python interpreter process exited with a non-zero exit code -1 Python 3.10.12
问题总结
目前存在两个问题:
- 无法将私有仓库镜像添加为PyCharm远程解释器
- 尽管已通过SSH直接连接远程虚拟机执行
docker login,但该认证未在PyCharm的SSH连接中生效(两者连接同一虚拟机与用户)
内容的提问来源于stack exchange,提问作者Louie_the_unsolver
相关产品推荐
相关产品推荐

