Juypterlab的Docker容器

时间:2018-10-25 13:25:08

标签: docker jupyter jupyter-lab

我想在子域中使用adminuser和另外十个用户来运行jupyterlab。我的第一步是构建一个Dockerfile。当我运行docker jupyter时,无法使用此令牌登录。 有一个警告JupyterLab服务器扩展未启用,请手动加载。如何解决此警告?

当我复制时 http://(e7ed07c07f1e或127.0.0.1):8888 /?token = a0dd4edab37a679497593f8e565c75e8fa5d1939fa8cc003,该浏览器会在Google中搜索。

我得到这个消息:

Step 7/7 : ENTRYPOINT ["jupyter", "lab", "--allow-root","--ip=0.0.0.0", "--no-browser"]
 ---> Running in 1c47b913a54c
Removing intermediate container 1c47b913a54c
 ---> 9068548fcfbb
Successfully built 9068548fcfbb
Successfully tagged jupyter:latest
[jklein@tobbie jupyter]$ docker run jupyter
[I 11:24:19.707 LabApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[I 11:24:20.018 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
[I 11:24:20.018 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[W 11:24:20.020 LabApp] JupyterLab server extension not enabled, manually loading...
[I 11:24:20.022 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
[I 11:24:20.022 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 11:24:20.023 LabApp] Serving notebooks from local directory: /
[I 11:24:20.023 LabApp] The Jupyter Notebook is running at:
[I 11:24:20.023 LabApp] http://(e7ed07c07f1e or 127.0.0.1):8888/?token=a0dd4edab37a679497593f8e565c75e8fa5d1939fa8cc003
[I 11:24:20.023 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:24:20.023 LabApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://(e7ed07c07f1e or 127.0.0.1):8888/?token=a0dd4edab37a679497593f8e565c75e8fa5d1939fa8cc003

Dockerfile

FROM continuumio/miniconda3

# Updating and upgrading packages
RUN apt-get update -y \
    && apt-get install -y \
    && apt-get upgrade -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN conda update -y conda
RUN conda install -y jupyter \
                     jupyterlab

# Setup application
EXPOSE  8888
ENTRYPOINT ["jupyter", "lab", "--allow-root","--ip=0.0.0.0", "--no-browser"]

1 个答案:

答案 0 :(得分:0)

  

当我复制http://(e7ed07c07f1e或   127.0.0.1):8888 /?token = a0dd4edab37a679497593f8e565c75e8fa5d1939fa8cc003,该浏览器会在Google中搜索。

那不是有效的网址。

首先,您需要通过暴露相关端口来启动Docker容器。运行以下内容。

docker run -d -p 8888:8888 <IMAGE_ID>

验证:

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
bafcbb8ddd23        b443ffa510a4        "jupyter lab --allow…"   3 seconds ago       Up 2 seconds        0.0.0.0:8888->8888/tcp   adoring_hypatia

并使用令牌访问:

http://127.0.0.1:8888/?token=a0dd4edab37a679497593f8e565c75e8fa5d1939fa8cc003

enter image description here