Docker暴露的端口无法访问

时间:2016-11-22 03:06:49

标签: docker tcp port netstat jupyterhub

我运行了一个公开端口443的docker容器。 docker 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

但是,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

我使用运行容器的命令只是http://www.networksolutions.com/support/what-is-web-forwarding-and-masking/

[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/

我在这里做错了什么?

1 个答案:

答案 0 :(得分:3)

默认情况下,此Jupyterhub Docker镜像只显示端口8000.您可以阅读here。要使用SSL(端口443),您可以执行一些额外的步骤。

您可以在端口8000上进行检查。

停止并移除您的容器

docker stop jupyterhub
docker rm jupyterhub

使用映射的端口启动jupyterhub:

docker run -d --name jupyterhub -p 443:443 -p 8000:8000 jupyterhub/jupyterhub jupyterhub

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
相关问题