python内核在运行Docker容器时找不到Vscode
我正在尝试构建一个Docker映像,以进行调试,该模块在Vscocde中具有许多奇怪的依赖项。
我正在使用下面的dockerfile来构建图像:
FROM ubuntu:20.04
USER root
RUN apt update -y && apt upgrade -y && \
apt install -y software-properties-common && \
add-apt-repository ppa:ubuntugis/ppa && \
apt update -y && apt install -y \
gdal-bin \
geotiff-bin \
git \
libgdal-dev \
libgl1 \
libspatialindex-dev \
wget \
python-is-python3 \
pip \
g++
RUN pip install Cython numpy
RUN git clone https://github.com/jgrss/geowombat.git
RUN pip install -r /geowombat/requirements.txt
RUN pip install sklearn-xarray pip-tools rtree ipykernel
RUN python -c "import geowombat as gw"
RUN python -c "import rasterio;from rasterio.crs import CRS; cc = CRS.from_epsg(4326)"
当交互式运行图像时(如我的测试所建议)时,我可以成功运行:
python
但是,当我使用vscode远程容器和docker扩展名时+p 要运行远程containers:连接到运行容器
我无法通过在.py
文件中执行代码来访问Python,并且如果我尝试使用.ipynb
它告诉我我需要从“市场”中安装一个python内核。
基本上,VSCODE似乎与默认的Python内核没有连接。
我是新手,所以任何建议都会有所帮助!
I am trying to build a docker image to do debuging of a module that has lots of odd dependencies in vscocde.
I am using the dockerfile below to build the image:
FROM ubuntu:20.04
USER root
RUN apt update -y && apt upgrade -y && \
apt install -y software-properties-common && \
add-apt-repository ppa:ubuntugis/ppa && \
apt update -y && apt install -y \
gdal-bin \
geotiff-bin \
git \
libgdal-dev \
libgl1 \
libspatialindex-dev \
wget \
python-is-python3 \
pip \
g++
RUN pip install Cython numpy
RUN git clone https://github.com/jgrss/geowombat.git
RUN pip install -r /geowombat/requirements.txt
RUN pip install sklearn-xarray pip-tools rtree ipykernel
RUN python -c "import geowombat as gw"
RUN python -c "import rasterio;from rasterio.crs import CRS; cc = CRS.from_epsg(4326)"
When running the image interactively (as my tests suggest) I can successfully run:
python
However when I use vscode remote containers and docker extension to "attach vscode" or use shift+cntr+p
to run Remote-Containers: Attach to running container
I am unable to access python by executing code in an .py
file and if I try using an .ipynb
it informs me I need to install a python kernel from 'the marketplace'.
Basically, vscode doesn't seem to have a connection to the default python kernel.
I am new to this, so any suggestions would be helpful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试基于 document )
You can try to create and update a dockerfile based on the document