如果容器的健康检查状态没有问题,需要绕过 routing 直接检查 web 容器的可访问性。如上图所示,可以查看到某个 web 容器的容器 IP,登录集群中某台机器的 routing 容器,通过容器 IP 请求 web 容器的页面,如果返回的 HTTP 状态码小于 400,则 web 容器的页面正常。如下所示,docker exec -it f171110f2fe2 sh 中 f171110f2fe2 是容器 acsrouting_routing_1 的容器 ID,curl -v 172.19.0.7 中的 IP 地址 172.19.0.7 是某个 web 服务的容器 IP 地址。如下所示,请求返回了状态码 302,说明 web 容器访问是正常的。
root@c68a460635b8c405e83c052b7c2057c7b-node2:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b403ea045fa1 registry.aliyuncs.com/acs-sample/wordpress:4.5 "/entrypoint.sh apach" 13 seconds ago Up 11 seconds 0.0.0.0:32768->80/tcp w_web_2
025f7967cec3 registry.aliyuncs.com/acs-sample/mysql:5.7 "/entrypoint.sh mysql" About a minute ago Up About a minute 3306/tcp w_db_1
2f247b8a76e5 registry.aliyuncs.com/acs/ilogtail:0.9.9 "/bin/sh -c 'sh /usr/" 31 minutes ago Up 31 minutes acslogging_logtail_1
42b75bee6cd8 registry.aliyuncs.com/acs/monitoring-agent:latest "acs-mon-run.sh --hel" 31 minutes ago Up 31 minutes acsmonitoring_acs-monitoring-agent_2
0a9afa527f03 registry.aliyuncs.com/acs/volume-driver:0.7-252cb09 "acs-agent volume_exe" 31 minutes ago Up 31 minutes acsvolumedriver_volumedriver_2
3c1440fd114c registry.aliyuncs.com/acs/logspout:0.1-41e0e21 "/bin/logspout" 32 minutes ago Up 32 minutes acslogging_logspout_1
f171110f2fe2 registry.aliyuncs.com/acs/routing:0.7-staging "/opt/run.sh" 32 minutes ago Up 32 minutes 127.0.0.1:1936->1936/tcp, 0.0.0.0:9080->80/tcp acsrouting_routing_1
0bdeb8464c14 registry.aliyuncs.com/acs/agent:0.7-bfe8bdf "acs-agent join --nod" 33 minutes ago Up 33 minutes acs-agent
ba32a0e9e7fe registry.aliyuncs.com/acs/tunnel-agent:0.21 "/acs/agent -config=c" 33 minutes ago Up 33 minutes tunnel-agent
root@c68a460635b8c405e83c052b7c2057c7b-node2:~# docker exec -it f171110f2fe2 sh
/ # curl -v 172.19.0.7
* Rebuilt URL to: 172.19.0.7/
* Trying 172.19.0.7...
* Connected to 172.19.0.7 (172.19.0.7) port 80 (#0)
> GET / HTTP/1.1
> Host: 172.19.0.7
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Mon, 09 May 2016 03:19:47 GMT
< Server: Apache/2.4.10 (Debian) PHP/5.6.21
< X-Powered-By: PHP/5.6.21
< Expires: Wed, 11 Jan 1984 05:00:00 GMT
< Cache-Control: no-cache, must-revalidate, max-age=0
< Pragma: no-cache
< Location: http://172.19.0.7/wp-admin/install.php
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host 172.19.0.7 left intact
/ #