I'm trying to connect to a MySQL host that only expose an IPv6 address from Wordpress running in Docker. I try to add the IP to the host like this:
$ docker run --name some-wordpress -e WORDPRESS_DB_HOST= \
-e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress
Where
Warning: mysqli::mysqli(): (HY000/2002): Invalid argument in - on line 10
Is there a way to connect Wordpress to MySQL in Docker using IPv6?
解决方案By default, the Docker server configures the container network for IPv4 only.
You can enable IPv4/IPv6 dualstack support by running the Docker daemon with the --ipv6 flag. Docker will set up the bridge docker0 with the IPv6 link-local address fe80::1.