我的实验失败了,2个ip都能访问一个Wordpress

来源:7-4 在swarm集群里通过service部署wordpress

煮剑_焚酒

2018-07-03

我是买了腾讯云的服务器,

docker service create --name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wordpress --mount type=volume,source=mysql-data,destination=/var/lib/mysql --network demo2 -p 8083:3306   mysql:5.7

docker service create --name wordpress -p 8084:80 -e WORDPRESS_DB_PASSWORD=root -e  WORDPRESS_DB_HOST=mysql --network demo2 wordpress

都连overlay的网络,两边的端口都开了

[root@VM_16_7_centos ~]# docker network inspect demo2
[
    {
        "Name": "demo2",
        "Id": "x5xcaph70qlmozy16xjysr1uc",
        "Created": "2018-07-03T15:51:20.98025037+08:00",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1337d31551f35655d9183602e8ac64e3aa03506a5bf7bc1814d4088af8ee6bd0": {
                "Name": "mysql.1.n55t1yakeqexf2r0q3o5dqlhl",
                "EndpointID": "df277f46e20501499543f67f51bdd668901eda165ebc2bff013a2f85890dd2a5",
                "MacAddress": "02:42:0a:00:00:22",
                "IPv4Address": "10.0.0.34/24",
                "IPv6Address": ""
            },
            "5c811410b28c8cfe503b22401a7f409ce5f2d402fc39e17c3a197da691137ac2": {
                "Name": "wordpress.1.0dg51q3nre9teiyfdhrtyfb2b",
                "EndpointID": "6b7fe68ed8c7dcf9c186be911219d0e626be50ad9f5b8826a5a1257f69cd0113",
                "MacAddress": "02:42:0a:00:00:29",
                "IPv4Address": "10.0.0.41/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4098"
        },
        "Labels": {},
        "Peers": [
            {
                "Name": "dda66d8003b4",
                "IP": "118.24.4.60"
            }
        ]
    }
]


写回答

1回答

麦兜搞IT

2018-07-03

"

2个ip都能访问一个Wordpress

"是什么意思呢

0
1
煮剑_焚酒
就是这个问题:在swarm集群里通过service部署wordpress 我在云主机上部署失败了
2018-07-03
共1条回复

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程