请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

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

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

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"
            }
        ]
    }
]


正在回答 回答被采纳积分+3

1回答

麦兜搞IT 2018-07-03 22:01:23

"

2个ip都能访问一个Wordpress

"是什么意思呢

0 回复 有任何疑惑可以回复我~
  • 提问者 煮剑_焚酒 #1
    就是这个问题:在swarm集群里通过service部署wordpress 我在云主机上部署失败了
    回复 有任何疑惑可以回复我~ 2018-07-03 22:21:55
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信