title: Can't connect Docker Wordpress container to MySQL on host
body: <p>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:</p>
  
  <pre><code>$ docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \ -e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>These repeat several times then it terminates.</p>
  
  <p>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?</p>