2016-11-22 218 views
3

我运行了一个Docker容器,该端口容器公开了端口443docker ps确认它是暴露的。Docker无法访问端口

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

我在这里做错了什么?

+1

您还可以包含您运行的命令来启动容器吗? – R0MANARMY

+0

我已将此信息添加到问题中。 – Fabian

回答

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