title: dockerizing wordpress with mysql installed on the host machine
body: <p>I am trying to run Wordpress on docker with mysql installed on my local host machine (ubuntu 14.04)</p>
  
  <p>I am using the docker image  from here: <a href="https://registry.hub.docker.com/_/wordpress/" rel="nofollow">https://registry.hub.docker.com/_/wordpress/</a></p>
  
  <p>I passed my host ip address (192.168.1.1) and the port (3306) as shown below</p>
  
  <pre><code>sudo docker run -it --name wp -e WORDPRESS_DB_HOST=192.168.1.1:3306 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=root -d wordpress
  </code></pre>
  
  <p>but I am getting the following error, when I try to run the image</p>
  
  <pre><code>"MySQL Connection Error: (2002) Connection refused"
  </code></pre>
  
  <p>Below are the exact steps, I follow</p>
  
  <pre><code>sudo docker run -it --name wp -e WORDPRESS_DB_HOST=192.168.1.1:3306 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=root -d wordpress
  
  sudo docker ps -a
  
  sudo docker commit &lt;container_id&gt; myuser/eslwp
  
  sudo docker images
  
  sudo docker run -i -t myuser/eslwp
  </code></pre>