[英]Running Jupyter notebook in docker image on Google Cloud
I'm running an Ubuntu 16.04 VM on Google Compute Engine. 我正在Google Compute Engine上运行Ubuntu 16.04 VM。 I've created a static IP address
<my_static_ip_address>
and my firewall settings allow tcp:80-8888. 我创建了一个静态IP地址
<my_static_ip_address>
,我的防火墙设置允许tcp:80-8888。
I started the Jupyter server within the docker image with 我在docker镜像中启动了Jupyter服务器
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root
and got this URL 并获得此URL
http://0.0.0.0:8888/?token=8b26c453d278eae1da71b80f26a4ef8ea06734e5c636d897
I'm not able to access from external browser with http://<my_static_ip_address>:8888
What am I missing? 我无法使用
http://<my_static_ip_address>:8888
从外部浏览器访问http://<my_static_ip_address>:8888
我缺少什么?
I started the Jupyter server within the docker image with
我在docker镜像中启动了Jupyter服务器
What was the docker command you ran? 你运行的docker命令是什么? A common gotcha here would be not mapping a host port to a container port.
这里常见的问题是没有将主机端口映射到容器端口。
For example, if you did this: 例如,如果你这样做:
docker run -p 8888 jupyter/notebook
Then docker would assign a random host port mapping to port 8888 in the container. 然后,docker会将随机主机端口映射分配给容器中的端口8888。 In this case, you can see what port was mapped by running
docker ps
. 在这种情况下,您可以通过运行
docker ps
来查看映射了哪个端口。 The port will be much higher than 8888 though, so you won't be able to reach jupyter because your firewall will block the traffic. 该端口将远远高于8888,因此您将无法访问jupyter,因为您的防火墙将阻止流量。
What you probably want to do is go ahead and map a host port like so: 您可能想要做的是继续映射主机端口,如下所示:
docker run -p 8888:8888 jupyter/notebook
This should map any traffic reaching the GCE host on port 8888 to port 8888 in your jupyter container. 这应该将到达端口8888上的GCE主机的任何流量映射到您的jupyter容器中的端口8888。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.