title: Setting up MySQL and importing dump within Dockerfile
body: <p>I'm trying to setup a Dockerfile for my LAMP project, but i'm having a few problems when starting MySQL. I have the folowing lines on my Dockerfile:</p>
  
  <pre><code>VOLUME ["/etc/mysql", "/var/lib/mysql"]
  ADD dump.sql /tmp/dump.sql
  RUN /usr/bin/mysqld_safe &amp; sleep 5s
  RUN mysql -u root -e "CREATE DATABASE mydb"
  RUN mysql -u root mydb &lt; /tmp/dump.sql
  </code></pre>
  
  <p>But I keep getting this error: </p>
  
  <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
  </code></pre>
  
  <p>Any ideas on how to setup database creation and dump import during a Dockerfile build?</p>