wordpress 连接mysql5.7失败

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

慕粉171731593

2019-10-22

docker service

ID NAME MODE REPLICAS IMAGE PORTS
yvd76fej08gl mysql replicated 1/1 mysql:5.7
ydrzkim3jfu2 wordpress replicated 1/1 wordpress:latest *:80->80/tcp

docker service ps mysql

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
q0ifulowi95j mysql.1 mysql:5.7 docker-node3 Running Running about an hour ago
5yfskiwhqr8i _ mysql.1 mysql:5.7 docker-node1 Shutdown Rejected about an hour ago “network sandbox join failed: …”
te944uagwb2o _ mysql.1 mysql:5.7 docker-node2 Shutdown Failed about an hour ago “task: non-zero exit (2)”
4ac3wcl329fh _ mysql.1 mysql:5.7 docker-node1 Shutdown Rejected about an hour ago “network sandbox join failed: …”
xa5jijf87ll6 _ mysql.1 mysql:5.7 docker-node1 Shutdown Rejected about an hour ago “network sandbox join failed: …”

docker service ps wordpress

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
gug17b0ier4n wordpress.1 wordpress:latest docker-node2 Running Running 14 minutes ago
xsmlq7g50pkf _ wordpress.1 wordpress:latest docker-node1 Shutdown Rejected 14 minutes ago “network sandbox join failed: …”
gxtkpmebwapc _ wordpress.1 wordpress:latest docker-node1 Shutdown Rejected 14 minutes ago “network sandbox join failed: …”

docker-node2 (wordpress)

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fba74e6adafc wordpress:latest “docker-entrypoint.s…” 16 minutes ago Up 16 minutes 80/tcp wordpress.1.gug17b0ier4nyfd76xppsrgbd

docker inspect wordpress.1.gug17b0ier4nyfd76xppsrgbd

[
    {
        "Id": "fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916",
        "Created": "2019-10-22T05:21:51.266188937Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "apache2-foreground"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 26762,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-10-22T05:21:56.197460701Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:264da8cf7ba42d49c313773e706e171d7dd13d25088fc98e6aba831cd1d19c5a",
        "ResolvConfPath": "/var/lib/docker/containers/fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916/hostname",
        "HostsPath": "/var/lib/docker/containers/fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916/hosts",
        "LogPath": "/var/lib/docker/containers/fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916/fba74e6adafcf0f39b049afdb0745a7c8d639ececbc9c1994c52c6375f1c6916-json.log",
        "Name": "/wordpress.1.gug17b0ier4nyfd76xppsrgbd",
        "RestartCount": 0,
        "Driver": "devicemapper",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "default",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ],
            "Init": false
        },
        "GraphDriver": {
            "Data": {
                "DeviceId": "64",
                "DeviceName": "docker-253:0-34280842-935c7d3ce0a8e0ac9c58e4f5833117f1943cb595aa6123ab9d890b499f80c887",
                "DeviceSize": "10737418240"
            },
            "Name": "devicemapper"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "fec2505646e1405423b8afa452166fe10717fc9da22f04311dad35140c416e49",
                "Source": "/var/lib/docker/volumes/fec2505646e1405423b8afa452166fe10717fc9da22f04311dad35140c416e49/_data",
                "Destination": "/var/www/html",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "fba74e6adafc",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "WORDPRESS_DB_PASSWORD=root",
                "WORDPRESS_DB_HOST=mysql",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "PHPIZE_DEPS=autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c",
                "PHP_INI_DIR=/usr/local/etc/php",
                "APACHE_CONFDIR=/etc/apache2",
                "APACHE_ENVVARS=/etc/apache2/envvars",
                "PHP_EXTRA_BUILD_DEPS=apache2-dev",
                "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2 --disable-cgi",
                "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2",
                "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2",
                "PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie",
                "GPG_KEYS=CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D",
                "PHP_VERSION=7.3.10",
                "PHP_URL=https://www.php.net/get/php-7.3.10.tar.xz/from/this/mirror",
                "PHP_ASC_URL=https://www.php.net/get/php-7.3.10.tar.xz.asc/from/this/mirror",
                "PHP_SHA256=42f00a15419e05771734b7159c8d39d639b8a5a6770413adfa2615f6f923d906",
                "PHP_MD5=",
                "WORDPRESS_VERSION=5.2.4",
                "WORDPRESS_SHA1=9eb002761fc8b424727d8c9d291a6ecfde0c53b7"
            ],
            "Cmd": [
                "apache2-foreground"
            ],
            "Image": "wordpress:latest@sha256:bc72bd27609e683fb37131191e9ed2c84a2615e98bc9fd3a3b20e8373b25c009",
            "Volumes": {
                "/var/www/html": {}
            },
            "WorkingDir": "/var/www/html",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.swarm.node.id": "z3i1xo38l3r3p3nhj50mffqny",
                "com.docker.swarm.service.id": "ydrzkim3jfu2ro613zufr8gwe",
                "com.docker.swarm.service.name": "wordpress",
                "com.docker.swarm.task": "",
                "com.docker.swarm.task.id": "gug17b0ier4nyfd76xppsrgbd",
                "com.docker.swarm.task.name": "wordpress.1.gug17b0ier4nyfd76xppsrgbd"
            },
            "StopSignal": "WINCH"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "fcf539b1b92d27f8d33a2c44d4eccd6071a1e042270df94495cb1589380ae363",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/fcf539b1b92d",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "demo": {
                    "IPAMConfig": {
                        "IPv4Address": "10.0.0.108"
                    },
                    "Links": null,
                    "Aliases": [
                        "fba74e6adafc"
                    ],
                    "NetworkID": "kfahwcv1tf2at8nuocma79br3",
                    "EndpointID": "bc88103cd46e6c44ec5b554c49a4555164b85db45f61fbff301144cf3dd25818",
                    "Gateway": "",
                    "IPAddress": "10.0.0.108",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:0a:00:00:6c",
                    "DriverOpts": null
                },
                "ingress": {
                    "IPAMConfig": {
                        "IPv4Address": "10.255.0.80"
                    },
                    "Links": null,
                    "Aliases": [
                        "fba74e6adafc"
                    ],
                    "NetworkID": "q48ozjrtp481qzdt9l4y03frw",
                    "EndpointID": "02ffe05579f2104c313b448d9c1cd513d973850d2df27474b428a833220e6d36",
                    "Gateway": "",
                    "IPAddress": "10.255.0.80",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:0a:ff:00:50",
                    "DriverOpts": null
                }
            }
        }
    }
]

docker-node3 (mysql)

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7205013dda2c mysql:5.7 “docker-entrypoint.s…” About an hour ago Up About an hour 3306/tcp, 33060/tcp mysql.1.q0ifulowi95jj599o3noskr3o

docker inspect mysql.1.q0ifulowi95jj599o3noskr3o

[
    {
        "Id": "7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7",
        "Created": "2019-10-22T04:12:40.150108488Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 6648,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-10-22T04:12:40.837706251Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:cd3ed0dfff7e89f4330db6eaca2a127423df03be229d04a7e9f614fb0849121f",
        "ResolvConfPath": "/var/lib/docker/containers/7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7/hostname",
        "HostsPath": "/var/lib/docker/containers/7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7/hosts",
        "LogPath": "/var/lib/docker/containers/7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7/7205013dda2cccd5f78c12a59028d4297e361683e5f15fb05d7582f0cb0f70a7-json.log",
        "Name": "/mysql.1.q0ifulowi95jj599o3noskr3o",
        "RestartCount": 0,
        "Driver": "devicemapper",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "default",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "Mounts": [
                {
                    "Type": "volume",
                    "Source": "mysql-data",
                    "Target": "/var/lib/mysql"
                }
            ],
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ],
            "Init": false
        },
        "GraphDriver": {
            "Data": {
                "DeviceId": "74",
                "DeviceName": "docker-253:0-50575855-99e83d5a352084c7336f518fabbd8325c31ee45642250f860a55f26c5260d94a",
                "DeviceSize": "10737418240"
            },
            "Name": "devicemapper"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "mysql-data",
                "Source": "/var/lib/docker/volumes/mysql-data/_data",
                "Destination": "/var/lib/mysql",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "7205013dda2c",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3306/tcp": {},
                "33060/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=root",
                "MYSQL_DATABASE=wordpress",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "MYSQL_MAJOR=5.7",
                "MYSQL_VERSION=5.7.28-1debian9"
            ],
            "Cmd": [
                "mysqld"
            ],
            "Image": "mysql:5.7@sha256:44b33224e3c406bf50b5a2ee4286ed0d7f2c5aec1f7fdb70291f7f7c570284dd",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.swarm.node.id": "9eeg6qowq18afhouxffnl9k2t",
                "com.docker.swarm.service.id": "yvd76fej08glkr5wi2zsi5nty",
                "com.docker.swarm.service.name": "mysql",
                "com.docker.swarm.task": "",
                "com.docker.swarm.task.id": "q0ifulowi95jj599o3noskr3o",
                "com.docker.swarm.task.name": "mysql.1.q0ifulowi95jj599o3noskr3o"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "188b6804662e9f7bc214405139b886e5b6b2ae2b8c6130069d5e1b807e463247",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": null,
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/188b6804662e",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "demo": {
                    "IPAMConfig": {
                        "IPv4Address": "10.0.0.92"
                    },
                    "Links": null,
                    "Aliases": [
                        "7205013dda2c"
                    ],
                    "NetworkID": "kfahwcv1tf2at8nuocma79br3",
                    "EndpointID": "a7eb2b26077d37004cae428c0368e5ca6ae7f286ea7887c65b7567f0ceaec40a",
                    "Gateway": "",
                    "IPAddress": "10.0.0.92",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:0a:00:00:5c",
                    "DriverOpts": null
                }
            }
        }
    }
]

wordpress logs

wordpress.1.gug17b0ier4n@docker-node2    | WordPress not found in /var/www/html - copying now...
wordpress.1.gug17b0ier4n@docker-node2    | Complete! WordPress has been successfully copied to /var/www/html
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:21:57 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:21:57 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:00 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:00 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:03 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:03 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:06 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:06 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:09 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:09 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:12 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:12 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:15 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:15 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:18 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:18 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:21 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:21 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:24 UTC] PHP Warning:  mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    | [22-Oct-2019 05:22:24 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in Standard input code on line 22
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | WARNING: unable to establish a database connection to 'mysql'
wordpress.1.gug17b0ier4n@docker-node2    |   continuing anyways (which might have unexpected results)
wordpress.1.gug17b0ier4n@docker-node2    |
wordpress.1.gug17b0ier4n@docker-node2    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.0.108. Set the 'ServerName' directive globally to suppress this message
wordpress.1.gug17b0ier4n@docker-node2    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.0.108. Set the 'ServerName' directive globally to suppress this message
wordpress.1.gug17b0ier4n@docker-node2    | [Tue Oct 22 05:22:24.839806 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.10 configured -- resuming normal operations
wordpress.1.gug17b0ier4n@docker-node2    | [Tue Oct 22 05:22:24.839858 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
wordpress.1.gug17b0ier4n@docker-node2    | 10.255.0.3 - - [22/Oct/2019:05:23:54 +0000] "GET / HTTP/1.1" 500 3003 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
wordpress.1.gug17b0ier4n@docker-node2    | 10.255.0.3 - - [22/Oct/2019:05:23:55 +0000] "GET /favicon.ico HTTP/1.1" 200 229 "http://192.168.205.11/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

wordpress.1.gug17b0ier4n@docker-node2 | WARNING: unable to establish a database connection to ‘mysql’

写回答

1回答

麦兜搞IT

2019-10-24

请问密码设置对了么。您可以通过docker exec(这个我们前面讲过)进入到mysql的container内部,然后通过mysql -u 命令尝试进入mysql shell试试

0
0

系统学习Docker 践行DevOps理念

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

3297 学习 · 1895 问题

查看课程