Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Docker - Ubuntu 20.04 - Automate Setting Timezone

If you are building from an Ubuntu 20.04 base image, you probably want to add the following to your Dockerfile in order to automatically set your timezone. That way your docker build wont stop/fail if any of the packages you are installing need this set.

# Fix timezone issue
ENV TZ=Europe/London
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Last updated: 21st August 2020
First published: 21st August 2020

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch