title: Docker mysql - run update command/script on image startup
body: <p>I wish to build a docker image with an initialised database.
  This initial data will contain a default client ref value 'XXX'.</p>
  
  <p>Here's my Dockerfile:</p>
  
  <pre><code>FROM mysql/mysql-server:5.7
  COPY data.sql /docker-entrypoint-initdb.d/
  </code></pre>
  
  <p>When starting up the container of this image, I need to replace the ref value with the user's particular value, 'ABCD', which will come from an environment variable set by a docker compose file.</p>
  
  <p>So the update query to run is something like:</p>
  
  <pre><code>update client set ref='ABCD' where ref='XXX'
  </code></pre>
  
  <p>How do I get the Dockerfile to do this? I don't think it can be a RUN command as I don't want the update to be part of the image build, but part of the startup of the image (it's fine if it runs this update on every startup).</p>
  
  <p>I have all the usual mysql env varibles set (MYSQL_ROOT_PASSWORD/MYSQL_ROOT_HOST/MYSQL_DATABASE/MYSQL_USER/MYSQL_PASSWORD) and hope to refer to another env var for the desired ref to be setting. Keen to see this could be done as raw commands as well as a script.</p>