无法访问 Docker 公开的端口

Fab*_*ian 4 port netstat tcp docker jupyterhub

我运行了一个暴露 port 的 docker 容器443docker ps确认它已暴露。

~ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
42b17c2a4b75        tmp/tmp             "/usr/bin/tini -- /bi"   57 seconds ago      Up 55 seconds       443/tcp             adoring_austin
Run Code Online (Sandbox Code Playgroud)

但是,netstat不显示此端口。我也无法从浏览器访问它。

~ netstat -lt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
Run Code Online (Sandbox Code Playgroud)

我使用运行容器的命令只是JupyterHub.

[I 2016-11-22 03:12:11.494 JupyterHub app:643] Writing cookie_secret to /jupyterhub_cookie_secret
[W 2016-11-22 03:12:12.562 JupyterHub app:304]
Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
[W 2016-11-22 03:12:12.655 JupyterHub app:757] No admin users, admin interface will be unavailable.
[W 2016-11-22 03:12:12.655 JupyterHub app:758] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2016-11-22 03:12:12.655 JupyterHub app:785] Not using whitelist. Any authenticated user will be allowed.
[I 2016-11-22 03:12:12.671 JupyterHub app:1231] Hub API listening on http://172.17.0.3:8081/hub/
[I 2016-11-22 03:12:12.676 JupyterHub app:968] Starting proxy @ http://*:443/
03:12:12.861 - info: [ConfigProxy] Proxying https://*:443 to http://172.17.0.3:8081
03:12:12.864 - info: [ConfigProxy] Proxy API at http://127.0.0.1:444/api/routes
[I 2016-11-22 03:12:12.883 JupyterHub app:1254] JupyterHub is now running at http://127.0.0.1:443/
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么?

Tua*_*uan 5

默认情况下,此 Jupyterhub Docker 映像仅公开端口 8000。您可以在此处阅读。要使用 SSL(端口 443),您可能需要执行一些额外的步骤。

您可以在端口 8000 上检查它。

停止并移除您的容器

docker stop jupyterhub
docker rm jupyterhub
Run Code Online (Sandbox Code Playgroud)

使用映射的端口启动 jupyterhub:

docker run -d --name jupyterhub -p 443:443 -p 8000:8000 jupyterhub/jupyterhub jupyterhub
Run Code Online (Sandbox Code Playgroud)

http://YOUR_DOCKER_IP:8000/ 上检查,端口 443 不可用。

docker ps
CONTAINER ID        IMAGE                   COMMAND             CREATED
STATUS              PORTS                                          NAMES
0a123216ee9f        jupyterhub/jupyterhub   "jupyterhub"        26 seconds ago
Up 3 seconds        0.0.0.0:443->443/tcp, 0.0.0.0:8000->8000/tcp   jupyterhub
Run Code Online (Sandbox Code Playgroud)