apt-get install tzdata noninteractive
This is the script I used
(Updated Version with input from @elquimista from the comments)
#!/bin/bashexport DEBIAN_FRONTEND=noninteractiveln -fs /usr/share/zoneinfo/America/New_York /etc/localtimeapt-get install -y tzdatadpkg-reconfigure --frontend noninteractive tzdata
Seems to work fine.
As one liner:
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
If someone wants to achieve it in Dockerfile
, use as below.
ENV DEBIAN_FRONTEND=noninteractiveRUN apt-get -y install tzdata
I have recently found the following solution in a Dockerfile building the Cingulata FHE library:
ln -snf /usr/share/zoneinfo/$(curl https://ipapi.co/timezone) /etc/localtime
It basically uses the API provided by ipapi.co to retrieve the timezone information. This automatically configures the timezone properly instead of skipping the dialog and using the default (UTC).