How to set up timezones in a GKE Pod

断了今生、忘了曾经 提交于 2019-12-11 08:29:23

问题


I deployed docker Linux to gcloud gke pod.

I added the code bellow, trying to set up the time zone in the dockerfile. This code is running correctly in a local docker. But it does not work in gcloud gke pod. The timezones are in local PST, timezones in GKE Pod are still in UTC. Please help!

ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

回答1:


I'm not sure how this is working on your local environment. Looks like you are missing (Ubuntu, Debian):

dpkg-reconfigure -f noninteractive tzdata

So in summary something like this:

echo America/Los_Angeles >/etc/timezone && \
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

This blog has a very good explanation, including how to do it Alpine Linux.



来源:https://stackoverflow.com/questions/53331463/how-to-set-up-timezones-in-a-gke-pod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!