I have an Ubuntu vm that I’ve spun up on my Mac. In the vm I have MySQL and Docker installed and I’m trying to run a container from a Wordpress image and connect to MySQL on the host vm. The Wordpress image documentation says to use:
$ docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \ -e WORDPRESS_DB_USER=… -e WORDPRESS_DB_PASSWORD=… -d wordpress
I’ve substituted in the IP address assigned to the host vm and the appropriate user, password and database name environment variables. The container comes up but then shuts down after a short while and the docker logs show:
vagrant@docker-blogs:/vagrant$ docker logs je-wordpress
WordPress not found in /var/www/html - copying now…
Complete! WordPress has been successfully copied to /var/www/html
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 10
MySQL Connection Error: (2002) Connection refused
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 10
MySQL Connection Error: (2002) Connection refused
MySQL Connection Error: (2002) Connection refused
Should this be doable? If so, what do need I use as the IP address for the host vm and do I need to configure anything else?
Thanks