title: Running python script inside Docker container wrong timezone
body: <p>I'm running a script inside a Docker container (python:3.6) and it shows me the wrong time in the logs. When using the following python code in the python console(inside the container) it gives me the correct timezone. </p>
  
  <pre><code>import datetime
  datetime.datetime.now()
  datetime.datetime(2019, 8, 3, 17, 26, 25, 662809)
  </code></pre>
  
  <p>Also, when running the <code>date</code> command inside the container, it gives the correct timezone.</p>
  
  <p>However, I have this print statement in my script:</p>
  
  <pre><code>print("Updating....", datetime.datetime.now())
  </code></pre>
  
  <p>This however, gives me the wrong timezone (2 hours off).</p>
  
  <p><a href="https://i.stack.imgur.com/wPiqM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wPiqM.png" alt="enter image description here"></a> </p>
  
  <p>This is my docker-compose.yml:</p>
  
  <pre><code>version: '3'
  services:
    app:
      container_name: app
      build: .
      restart: unless-stopped
      environment:
        TZ: Europe/Amsterdam
      depends_on:
        - db
    db:
      container_name: db
      image: mariadb
      restart: unless-stopped
      environment:
        MYSQL_ROOT_PASSWORD: x
        MYSQL_DATABASE: x
        MYSQL_USER: x
        MYSQL_PASSWORD: x
        TZ: Europe/Amsterdam
      volumes:
        - /volumes/x/db:/var/lib/mysql
  </code></pre>
  
  <p>This is my crontab file (runs inside the app container)</p>
  
  <pre><code>CRON_TZ=Europe/Amsterdam
  
  */5 * * * * cd /usr/src/app &amp;&amp; /usr/local/bin/python3.6 -u -m x &gt; /proc/1/fd/1 2&gt;/proc/1/fd/2
  0,30 * * * * cd /usr/src/app &amp;&amp; /usr/local/bin/python3.6 -u -m x &gt; /proc/1/fd/1 2&gt;/proc/1/fd/2
  5 0 * * * cd /usr/src/app &amp;&amp; /usr/local/bin/python3.6 -u -m x &gt; /proc/1/fd/1 2&gt;/proc/1/fd/2
  </code></pre>
  
  <p>I tried setting the timezone in <code>docker-compose.yml</code>, that worked for <code>date</code> command and the python console. I tried setting the timezone inside the crontab file, but it still doesn't show the correct timezone in the script.</p>
  
  <p>How do I set the timezone for Python inside a crontab, so that the logs do have the correct timezone? Also, I need to run a script at 00:05 not 22:05, does that work now?</p>