J.G*_*min 51 python docker jupyter-notebook
我用python库和Jupyter创建了一个docker镜像.我使用选项启动容器-p 8888:8888
,以链接主机和容器之间的端口.当我在容器中启动Jupyter内核时,它正在运行localhost:8888
(并且没有找到浏览器).我用了这个命令jupyter notebook
但是从我的主机,我必须使用什么IP地址与主机的浏览器中的Jupyter一起工作?
随着命令ifconfig
,我发现eth0
,docker
,wlan0
,lo
...
谢谢 !
小智 55
你需要运行你的笔记本0.0.0.0
:jupyter notebook -i 0.0.0.0
.在localhost上运行使其仅在容器内部可用.
Lah*_*tne 25
主机: docker run -it -p 8888:8888 image:version
容器内: jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
主机访问此网址: localhost:8888/tree??
当您第一次登录时,终端上将显示一个链接,用于使用令牌登录.
要获取到Jupyter笔记本服务器的链接:
您之后docker run
的命令,超链接应自动生成.它看起来像这样:http://localhost:8888/?token=f3a8354eb82c92f5a12399fe1835bf8f31275f917928c8d2 :: /home/jovyan/work
如果您想稍后再次获取该链接,可以键入docker exec -it <docker_container_name> jupyter notebook list
.
该docker run
命令是打开容器的端口所必需的,以允许从主机浏览器进行连接,使用-p将端口分配给docker容器,然后从中选择jupyter映像docker images
。
docker run -it -p 8888:8888 image:version
Run Code Online (Sandbox Code Playgroud)
在容器内,启动笔记本并分配您打开的端口:
jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root
Run Code Online (Sandbox Code Playgroud)
通过http:// localhost:8888上的桌面浏览器访问笔记本 ,笔记本将提示您输入创建笔记本时生成的令牌。
下面是我如何使用 docker toolbox 在 Windows 7 上运行它。
如果您使用的是 docker 工具箱,请打开 Docker 快速启动终端,并在此处记下 IP:
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
Run Code Online (Sandbox Code Playgroud)
从tensorflow安装网站运行docker命令后:
docker pull tensorflow/tensorflow # Download latest image
docker run -it -p 8888:8888 tensorflow/tensorflow # Start a Jupyter notebook server
Run Code Online (Sandbox Code Playgroud)
您将收到如下消息:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://127.0.0.1:8888/?token=d6e80acaf08e09853dc72f6b0f022b8225f94f
Run Code Online (Sandbox Code Playgroud)
在主机中,将127.0.0.1替换为192.168.99.100并使用该 URL 的其余部分
归档时间: |
|
查看次数: |
47146 次 |
最近记录: |