• Home
  • Free Stuff
  • About
  • Contact

Automatically Setting Timezone on Dockerfile

July 30, 2019

As I lives in Indonesia, I would prefer to use GMT+7 as my selected timezone. It will make my log easier to check and also easier to find events at a certain time.

Below are a sample command to set timezone on Ubuntu based docker images :

#################################################################

# Dockerfile for Excellent Ubuntu Standard

# Based on Ubuntu 18.04

# Created by Masim Vavai Sugianto

#################################################################

FROM ubuntu:18.04

MAINTAINER Masim Vavai Sugianto <mynickname@vavai.net>
ARG DEBIAN_FRONTEND=noninteractive

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && apt-get update && apt-get install apt-utils tzdata

RUN echo "tzdata tzdata/Areas select Asia\ntzdata tzdata/Zones/Asia select Jakarta" > /tmp/tz ; debconf-set-selections /tmp/tz; rm /etc/localtime /etc/timezone; dpkg-reconfigure -f noninteractive tzdata
BashDockerUbuntu
Share

Linux

Masim "Vavai" Sugianto
Traveller, Open Source Enthusiast & Book Lover. Works as Independent Worker & Self-Employer.

Comment


Dani
December 29, 2020 at 18:07
Reply

Hello:
Thanks

Here:
apt-get install apt-utils tzdata

is missing “-y”

apt-get install -y apt-utils tzdata

Best regards.



Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Recent Posts

    • Januari 2021 Portfolio Update
    • December 2020 Portfolio Update
    • After a While
    • Life goes On : Farming
    • Pursuing FIRE in Indonesia : Are You Prepared For A Recession?
    • VirtualBox Error Kernel Driver not Installed (rc=-1908) on Zorin OS 15.2
    • ZorinOS on Intel NUC Hades Canyon Series NUC817HVK
    • Banana Farm
    • Zorin OS 15.2 Ultimate
    • Haraka and LDAP Authentication with Zimbra



© Copyright LetsBlog Theme Demo - Theme by ThemeGoods