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