title: Configure timezone in dockerized Nginx + PHP-FPM
body: <p>I need to set the default timezone in a Dockerfile. I have two containers (nginx and php7-fpm).</p>
  <p>When I enter the PHP container's bash and run <code>php --info | grep timezone</code> I get:</p>
  <blockquote>
  <p>Default timezone =&gt; UTC</p>
  <p>date.timezone =&gt; no value =&gt; no value</p>
  </blockquote>
  <p>My dockerfiles are the following:</p>
  <p><strong>nginx/Dockerfile:</strong></p>
  <pre><code>FROM debian:jessie
  
  RUN apt-get update &amp;&amp; apt-get install -y nginx
  
  ADD nginx.conf /etc/nginx/
  ADD site.conf /etc/nginx/sites-available/
  
  RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site
  RUN rm /etc/nginx/sites-enabled/default
  
  RUN echo &quot;upstream php-upstream { server php:9000; }&quot; &gt; /etc/nginx/conf.d/upstream.conf
  
  RUN usermod -u 1000 www-data
  
  CMD [&quot;nginx&quot;]
  
  EXPOSE 80
  EXPOSE 443
  </code></pre>
  <p><strong>php-fpm/Dockerfile:</strong></p>
  <pre><code>FROM php:7.0-fpm
  
  RUN apt-get update &amp;&amp; apt-get install -y git unzip
  
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  RUN composer --version
  
  RUN rm /etc/localtime
  RUN ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime
  RUN &quot;date&quot;
  
  RUN docker-php-ext-install pdo pdo_mysql
  
  RUN pecl install xdebug
  RUN docker-php-ext-enable xdebug
  RUN echo &quot;error_reporting = E_ALL&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;display_startup_errors = On&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;display_errors = On&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;xdebug.remote_enable=1&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;xdebug.remote_connect_back=1&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;xdebug.idekey=\&quot;PHPSTORM\&quot;&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  RUN echo &quot;xdebug.remote_port=9001&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  
  WORKDIR /var/www/site
  </code></pre>
  <p>I've tried to use the answers of similar questions with no results.</p>
  <p>Note: I'm using <code>docker-compose build</code> and <code>docker-compose up -d</code> to run the complete stack, which is exactly <a href="https://github.com/carlosas/full-docker-for-symfony-3" rel="noreferrer">this one</a>.</p>