gpt4 book ai didi

Azure 容器服务无法访问

转载 作者:行者123 更新时间:2023-12-02 19:35:00 24 4
gpt4 key购买 nike

我学习了几个有关 Azure 容器服务的教程,但最终却一次又一次地遇到同样的问题。

按照以下步骤操作:https://blogs.msdn.microsoft.com/jcorioland/2016/04/25/create-a-docker-swarm-cluster-using-azure-container-service

我成功地使用一个简单的“hello world”之类的应用程序启动了一个容器。通过与 swarm master 的 SSH 连接,我确认容器正在运行。

sudo docker ps -a

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                                                                NAMES
50f5ff6bc553 nginx "nginx -g 'daemon ..." 19 minutes ago Up 19 minutes 0.0.0.0:80->80/tcp hello-nginx
15bec25756d6 swarm:1.1.0 "/swarm manage --r..." 40 minutes ago Up 39 minutes 0.0.0.0:2375->2375/tcp containers_swarm_1
f3ae3f6fda89 progrium/consul "/bin/start -serve..." 40 minutes ago Up 39 minutes 0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 53/tcp, 53/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8301-8302->8301-8302/udp containers_consul_1

curl 本地主机

<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
} </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>

<p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p> </body> </html>

我获取了代理负载均衡器的公共(public) IP 地址并在端口 80 上访问它。

请求花费了很长时间,但最终失败,13.80.158.161 响应时间太长。

我做错了什么?

更新:

master 上的 docker node ls 返回以下错误:

Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

这显然是问题的根源。尚不确定根本原因或修复方法。

最佳答案

根据sudo docker ps -a的输出,看来您在master上创建了docker,也许您可​​以通过master公共(public)IP地址访问它。

我按照你提供的link测试了它,这是我的测试的输出:
大师:

jason@swarm-master-E3E95783-0:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d744da42d16 swarm:1.1.0 "/swarm manage --r..." About an hour ago Up About an hour 0.0.0.0:2375->2375/tcp containers_swarm_1
c63107d50414 progrium/consul "/bin/start -serve..." About an hour ago Up About an hour 0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 53/tcp, 53/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8301-8302->8301-8302/udp containers_consul_1
jason@swarm-master-E3E95783-0:~$

代理:

jason@swarm-agent-E3E95783000000:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f5b28cd76d6 nginx "nginx -g 'daemon ..." 41 minutes ago Up 41 minutes 0.0.0.0:80->80/tcp hello-nginx
jason@swarm-agent-E3E95783000000:~$

这是输出:

jason@swarm-agent-E3E95783000000:~$ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}

在您的场景中,也许您可以访问您的主公共(public) IP 地址

要访问它,我们应该将端口 80 添加到入站规则以主负载均衡器。

enter image description here

关于Azure 容器服务无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46591016/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com