Docker公开的端口不可访问

我运行了一个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 

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

我用这个命令运行容器只是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/ 

我在这里做错了什么?

默认情况下,这个Jupyterhub Docker镜像只是公开端口8000.你可以在这里阅读。 要使用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