title: Configure time zone to mysql docker container
body: <p>I have a mysql 5.7 docker container. When I run the mysql command:</p>
  
  <pre><code>SELECT now();
  </code></pre>
  
  <p>It shows the time -3 hours to my current time (which is logical). I want to set the time zone in a config file. Following the documentation in <a href="https://hub.docker.com/_/mysql/" rel="noreferrer">https://hub.docker.com/_/mysql/</a> I create a volume in my <code>docker-compose.yml</code> file like the following:</p>
  
  <pre><code>mysqldb:
      image: mysql:5.7.21
      container_name: mysql_container
      ports:
        - "3306:3306"
      volumes:
        - ./.docker/etc/mysql/custom.cnf:/etc/mysql/conf.d/custom.cnf
  </code></pre>
  
  <p>When I browse the files inside the container the file <code>custom.cnf</code> is there.
  In that file, I tried some of the ways I found as solutions like:</p>
  
  <pre><code>[mysqld]
  default_time_zone='Europe/Sofia'
  </code></pre>
  
  <p>or a compromise solution which is less elegant as the zone will have to be changed twice a year (summer / winter):</p>
  
  <pre><code>[mysqld]
  default_time_zone='+03:00'
  </code></pre>
  
  <p>but none works. I have the sensation the this file is not loaded by mysql at all because if I try to put invalid configuration in there nothing happens either (the container starts normally).
  Any suggestions on that?</p>