暴露jupyter容器的备用端口不起作用

时间:2019-01-30 14:18:01

标签: r docker jupyter-notebook

我正在尝试在端口10000上运行r-noteb ook(https://hub.docker.com/r/jupyter/r-notebook/)的jupyter容器。

使用命令:

docker run -p 10000:10000 jupyter/r-notebook

这是输出:

Executing the command: jupyter notebook
[I 14:14:28.508 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 14:14:28.954 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
[I 14:14:28.955 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 14:14:28.959 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 14:14:28.959 NotebookApp] The Jupyter Notebook is running at:
[I 14:14:28.959 NotebookApp] http://(165e94335316 or 127.0.0.1):8888/?token=45a5ff037dfa5dfd8aca69ae8489b4bb814009a9b7f6abf6
[I 14:14:28.959 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:14:28.961 NotebookApp]

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

来自输出:

to login with a token:
            http://(165e94335316 or 127.0.0.1):8888/?token=45a5ff037dfa5dfd8aca69ae8489b4bb814009a9b7f6abf6

可以看到端口8888而不是10000暴露了

我是否正确映射了端口?

在浏览器上访问http://localhost:10000/http://127.0.0.1:10000/http://165e94335316:10000/会返回“找不到页面”错误。

1 个答案:

答案 0 :(得分:1)

使用docker run -p 10000:8888 jupyter/r-notebook运行它并访问http://localhost:10000。右侧端口应该为8888,因为所有Jupyter笔记本电脑容器都暴露在端口8888上,如here所示。

-p 10000:8888中,8888是jupyter Notebook在容器内部运行的端口。 10000是容器中运行的笔记本计算机暴露于主机的端口。

另一个提示::要从http://localhost:8888访问Jupyter笔记本,请将10000更改为8888

docker run -p 8888:8888 jupyter/r-notebook