使用 docker 安装后无法访问 Rancher UI
Unable to access Rancher UI after installed using docker
我使用 docker,所以我通过此命令行使用 rancher/server docker run -d --restart=always -p 8080:8080 rancher/server
我检查了 docker 个容器(docker ps -a
)我发现这个:
dc191cba6ce8 rancher/server "/usr/bin/s6-svscan /" 10 minutes ago Up 27 seconds 3306/tcp, 0.0.0.0:8080->8080/tcp naughty_almeida
iptables 内容:
Chain ufw-user-input (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8080
看起来不错,但我无法访问 rancher ui 页面:
http://IP:8080
docker 记录 dc191cba6ce8:
2016-07-19 17:58:55,936 INFO [main] [ConsoleStatus] [1/32] [0ms] [0ms] Loading bootstrap
2016-07-19 17:58:56,267 INFO [main] [ConsoleStatus] [2/32] [330ms] [329ms] Loading config-defaults
2016-07-19 17:59:09,243 INFO [main] [ConsoleStatus] [3/32] [13307ms] [12976ms] Loading system
2016-07-19 17:59:09,410 INFO [main] [ConsoleStatus] [4/32] [13474ms] [166ms] Loading defaults
2016-07-19 17:59:10,482 INFO [main] [ConsoleStatus] [5/32] [14546ms] [1072ms] Loading types
2016-07-19 17:59:21,385 INFO [main] [ConsoleStatus] [6/32] [25449ms] [10902ms] Loading system-services
2016-07-19 17:59:22,058 INFO [main] [ConsoleStatus] [7/32] [26122ms] [673ms] Loading agent-server
2016-07-19 17:59:22,794 INFO [main] [ConsoleStatus] [8/32] [26858ms] [736ms] Loading allocator-server
DEBUG(所有comments/chat的总结):
首先我们检查它是否是端口映射问题:
docker inspect dc191cba6ce8 | grep IPAddress
哪个返回了IP:172.17.x.x
当他能够 curl 172.17.x.x:8080
输出时:
这必须 return 类似于:
{"type":"collection","resourceType":"apiVersion","links":{"self":"http://172.17.0.6:8080/","latest":"http://172.17.0.6:8080/v1"},"createTypes":{},"actions":{},"data":[{"id":"v1","type":"apiVersion","links":{"self":"http://172.17.0.6:8080/v1"},"actions":{}}],"sortLinks":{},"pagination":null,"sort":null,"filters":{},"createDefaults":{}}
所以首先我们想到了一个端口映射的问题。但是在重新检查日志后,我发现容器启动存在问题:
docker logs dc191cba6ce8
的输出显示:
2016-07-19 17:58:55,936 INFO [main] [ConsoleStatus] [1/32] [0ms] [0ms] Loading bootstrap
2016-07-19 17:58:56,267 INFO [main] [ConsoleStatus] [2/32] [330ms] [329ms] Loading config-defaults
2016-07-19 17:59:09,243 INFO [main] [ConsoleStatus] [3/32] [13307ms] [12976ms] Loading system
2016-07-19 17:59:09,410 INFO [main] [ConsoleStatus] [4/32] [13474ms] [166ms] Loading defaults
2016-07-19 17:59:10,482 INFO [main] [ConsoleStatus] [5/32] [14546ms] [1072ms] Loading types
2016-07-19 17:59:21,385 INFO [main] [ConsoleStatus] [6/32] [26858ms] [736ms] Loading allocator-server
然后就停了。所以容器启动出现了问题。这是因为服务器只有 512MB 的 RAM。
dockerhub 上 运行 游侠容器的一些先决条件:
RAM: 1GB+
因此在创建更大的服务器(或在本地创建)后,它能够以正确的方式启动容器并在浏览器中访问控制台。
只需在浏览器中输入 dockerhost:{here 443} ,如果您正在使用代理,则禁用它。
我使用 docker,所以我通过此命令行使用 rancher/server docker run -d --restart=always -p 8080:8080 rancher/server
我检查了 docker 个容器(docker ps -a
)我发现这个:
dc191cba6ce8 rancher/server "/usr/bin/s6-svscan /" 10 minutes ago Up 27 seconds 3306/tcp, 0.0.0.0:8080->8080/tcp naughty_almeida
iptables 内容:
Chain ufw-user-input (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8080
看起来不错,但我无法访问 rancher ui 页面:
http://IP:8080
docker 记录 dc191cba6ce8:
2016-07-19 17:58:55,936 INFO [main] [ConsoleStatus] [1/32] [0ms] [0ms] Loading bootstrap
2016-07-19 17:58:56,267 INFO [main] [ConsoleStatus] [2/32] [330ms] [329ms] Loading config-defaults
2016-07-19 17:59:09,243 INFO [main] [ConsoleStatus] [3/32] [13307ms] [12976ms] Loading system
2016-07-19 17:59:09,410 INFO [main] [ConsoleStatus] [4/32] [13474ms] [166ms] Loading defaults
2016-07-19 17:59:10,482 INFO [main] [ConsoleStatus] [5/32] [14546ms] [1072ms] Loading types
2016-07-19 17:59:21,385 INFO [main] [ConsoleStatus] [6/32] [25449ms] [10902ms] Loading system-services
2016-07-19 17:59:22,058 INFO [main] [ConsoleStatus] [7/32] [26122ms] [673ms] Loading agent-server
2016-07-19 17:59:22,794 INFO [main] [ConsoleStatus] [8/32] [26858ms] [736ms] Loading allocator-server
DEBUG(所有comments/chat的总结): 首先我们检查它是否是端口映射问题:
docker inspect dc191cba6ce8 | grep IPAddress
哪个返回了IP:172.17.x.x
当他能够 curl 172.17.x.x:8080
输出时:
这必须 return 类似于:
{"type":"collection","resourceType":"apiVersion","links":{"self":"http://172.17.0.6:8080/","latest":"http://172.17.0.6:8080/v1"},"createTypes":{},"actions":{},"data":[{"id":"v1","type":"apiVersion","links":{"self":"http://172.17.0.6:8080/v1"},"actions":{}}],"sortLinks":{},"pagination":null,"sort":null,"filters":{},"createDefaults":{}}
所以首先我们想到了一个端口映射的问题。但是在重新检查日志后,我发现容器启动存在问题:
docker logs dc191cba6ce8
的输出显示:
2016-07-19 17:58:55,936 INFO [main] [ConsoleStatus] [1/32] [0ms] [0ms] Loading bootstrap
2016-07-19 17:58:56,267 INFO [main] [ConsoleStatus] [2/32] [330ms] [329ms] Loading config-defaults
2016-07-19 17:59:09,243 INFO [main] [ConsoleStatus] [3/32] [13307ms] [12976ms] Loading system
2016-07-19 17:59:09,410 INFO [main] [ConsoleStatus] [4/32] [13474ms] [166ms] Loading defaults
2016-07-19 17:59:10,482 INFO [main] [ConsoleStatus] [5/32] [14546ms] [1072ms] Loading types
2016-07-19 17:59:21,385 INFO [main] [ConsoleStatus] [6/32] [26858ms] [736ms] Loading allocator-server
然后就停了。所以容器启动出现了问题。这是因为服务器只有 512MB 的 RAM。 dockerhub 上 运行 游侠容器的一些先决条件:
RAM: 1GB+
因此在创建更大的服务器(或在本地创建)后,它能够以正确的方式启动容器并在浏览器中访问控制台。
只需在浏览器中输入 dockerhost:{here 443} ,如果您正在使用代理,则禁用它。