同一网络中的Docker容器无法通信

问题描述 投票:0回答:1

我在同一个桥接网络中有2个容器,但是它们无法通信,所以我找不到原因。

事实上,我有一个nginx容器,用于将代理传递给另一个容器“ gogs”,但是找不到代理,并且出现错误“无路由”

这是我的网络:

[root@pc-59 _data]# docker inspect nginxnet
[
    {
        "Name": "nginxnet",
        "Id": "f00a094d2dcd15d3a42e142b46245f41408f6d4013b17cf7992d0b573f3d07a4",
        "Created": "2019-12-27T20:17:37.878562424+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.3.27.0/24",
                    "Gateway": "172.3.27.2"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "253bd8d76090cb170d25ac1eb84cd411ea8d9c92f5dca7bfbb0133934c4be355": {
                "Name": "nginx",
                "EndpointID": "6bd16e068e16cd1ee060b00c6150bc9f1f579f9b17518e90f603ad64a099cf52",
                "MacAddress": "02:42:ac:03:1b:04",
                "IPv4Address": "172.3.27.4/24",
                "IPv6Address": ""
            },
            "53bf139329162bedb94a89bdfcc6c308684e923e3b825e7a5cb377f5a30ca71c": {
                "Name": "mariadb",
                "EndpointID": "6a4138a66f5b67cbae63a600532b80d51530da8bec867f250ed51d5a67bf3660",
                "MacAddress": "02:42:ac:03:1b:06",
                "IPv4Address": "172.3.27.6/24",
                "IPv6Address": ""
            },
            "c44952cf1fb97cf03b39b56a6824b6a2cbcb4f5c2836e5834336fde17cf8ad1d": {
                "Name": "gogs",
                "EndpointID": "f1642c905b0343bbaf28db8286b06917155fe80a3bd7c1dcc6618ece1c5c865a",
                "MacAddress": "02:42:ac:03:1b:05",
                "IPv4Address": "172.3.27.5/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

这是代理的nginx配置:

server {
  listen 443 ssl;
  server_name gogs.isin.party;

  ssl_certificate /etc/nginx/gogs.fullchain.pem; # Localisation de certifcat
  ssl_certificate_key /etc/nginx/gogs.privkey.pem; # Localisation de la clef
  ssl_protocols TLSv1.2; # Protocole SSL/TLS autorisé
  ssl_prefer_server_ciphers on; # Activation du chiffrement coté serveur
  ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

  location / {
    rewrite ^/?(.*)$ /$1 break;
    proxy_pass  http://172.3.27.5:3000;
  }

}

以及当我尝试访问我的网站“ gogs”时得到的确切错误:

No route to host) while connecting to upstream, client: 192.168.1.11, server: gogs.fr, request: "GET / HTTP/1.1", upstream: "http://172.3.27.5:3000/"

FYI,主机为centos 8,并且如果我在服务器主机上的telnet localhost 3000工作(侦听),但是如果我从nginx容器中进行了[[telnet 172.3.27.5 3000,则它将失败。

任何有帮助的想法吗?
docker nginx centos docker-networking
1个回答
-2
投票
他们的门敞开了吗?
© www.soinside.com 2019 - 2024. All rights reserved.