我在 dockerfile 下创建并根据他们的文档添加了novnc和websockify。novnc_proxy
在 docker run 之后,我可以在 docker 入口点内的脚本输出的复制粘贴 URL 后在浏览器上看到连接页面。
但是,一旦我尝试单击连接,它就会给我一条错误消息failed to connect the server
。有谁知道,如何解决这个错误?或者是否有一些我错过了运行 VNC 的配置?
Dockerfile
FROM python:3.8.0
ENV DISPLAY :1
RUN git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it && \
bash ~/.bash_it/install.sh --silent
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get upgrade -y && \
apt-get install -y nodejs \
supervisor \
openssl \
xvfb \
x11vnc \
openbox && apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip && \
pip install --upgrade \
PyVirtualDisplay \
pillow \
numpy \
pandas \
dash \
Jupyterlab \
ipywidgets \
jupyterlab-git \
jupyter-server-proxy \
jupyter-dash \
jupyterlab-novnc \
nbserverproxy
RUN jupyter lab build
# RUN pip install --upgrade pip && \
# pip install --upgrade \
# jupyterlab "pywidgets>=7.5"
RUN jupyter serverextension enable --py nbserverproxy
RUN jupyter labextension install \
jupyterlab-plotly@4.14.3 \
@jupyter-widgets/jupyterlab-manager \
@jupyterlab/git \
@jupyterlab/server-proxy
COPY config/ /root/.jupyter/
VOLUME /notebooks
WORKDIR /notebooks
RUN git clone https://github.com/novnc/noVNC.git ./novnc && \
git clone https://github.com/novnc/websockify.git ./novnc/utils/websockify
COPY entrypoint.sh .
RUN chmod -R 755 /notebooks/
EXPOSE 8888 8050 5901 6080 8081
ENTRYPOINT ["/notebooks/entrypoint.sh"]
入口点.sh
echo
jupyter lab --allow-root --ip=* --port=8888 &
/notebooks/novnc/utils/novnc_proxy --vnc localhost:5901 --listen 6080
fg %1
我构建了 docker 镜像并运行了 docker 镜像
docker run -it -p 8888:8888 -p 8050:8050 -p 5901:5901 -p 6080:6080 <ImageName>
此 docker run 的 O/p 如下所示:
而不是标准输出中显示的url,如果我尝试登录http://localhost:6080/vnc.html?host=localhost&port=6080
,它会显示我的登录浏览器,但只要我点击连接它就会显示
failed to connect the server
在容器内,我可以看到websockify
服务正在运行
我怀疑这是因为 websocket 连接问题,但不知道这里需要做什么。