title: Docker - MySQL container does not keep running
body: <p>I need some help with using MySQL in a Docker container. I thought the entire point of Docker was to isolate processes in sandboxes and have them run like normal processes - I am not getting this functionality.</p>
  
  <p>Whenever I run a MySQL container that I have built from my own image, it runs for 2 seconds, then stops. Trying <code>docker run -i -t &lt;imageid&gt;</code> gives me this:</p>
  
  <pre><code>root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# docker run -i -t e2d
  150221 05:25:21 mysqld_safe Logging to '/var/lib/mysql/28123b6d1dad.err'.
  150221 05:25:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  150221 05:25:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
  root@CenturionX:/home/centurionx/Code/Git/gdms-rcon# 
  </code></pre>
  
  <p>Why does the daemon not stay open? I have my <code>Dockerfile</code>, which looks like:</p>
  
  <pre><code># This docker file constructs a MySQL database instance
  FROM mysql:latest
  
  ADD . /gdms-rcon/mysql
  WORKDIR /gdms-rcon/mysql
  
  ENTRYPOINT ["/usr/bin/mysqld_safe"]
  
  EXPOSE 3306
  </code></pre>
  
  <p>And a <code>fig.yml</code> file to help me automate the build process:</p>
  
  <pre><code>mysql:
    build: .
    volumes:
      - .:/gdms-rcon/mysql
    working_dir: /gdms-rcon/mysql
    ports:
      - "3306:3306"
    environment:
      - MYSQL_DATABASE=mydb
      - MYSQL_ROOT_PASSWORD=mypassword
  </code></pre>