-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I set the timezone please? #136
Comments
I think that first line is correct, but you need to install the "tzdata"
package first.
|
Thanks, I go to have a try now |
Based on the |
Why does this not work? (Usually people set a soft link, but even copy doesn't do the trick.)
|
On the alpine bug list, Christian Kampka advised
He also said
I don't understand this, but after adding -U and substituting TZ in the Dockerfile it works now as intended. |
|
Sorry for commenting on a closed issue, but sometimes I just want to deploy a simple application using Docker Compose with some alpine-based containers inside... then I'm forced to override every dockerfile (or use on-the-fly configuration).
Even if it's not a bug, would we consider taking it as an usage issue? |
After using previous code it started to show current time zone as I understand, but time stays as before. |
@StalkAlex no idea where that $ docker run -it --rm alpine:3.6
/ # apk add --no-cache tzdata
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/1) Installing tzdata (2017a-r0)
Executing busybox-1.26.2-r7.trigger
OK: 7 MiB in 12 packages
/ # export TZ='America/Los_Angeles'
/ # date
Wed Nov 1 10:09:26 PDT 2017 In a FROM alpine:3.6
RUN apk add --no-cache tzdata
ENV TZ America/Los_Angeles |
It's OK in
Strangely it switches to GMT here (no tzdata installed)?!
|
Add tzdata so we can use the environment variable TZ to set a local timezone. Alpine lacks the package tzdata. Also bump version. For more information about Alpine images: gliderlabs/docker-alpine#136
Add tzdata so we can use the environment variable TZ to set a local timezone. Alpine lacks the package tzdata. Also bump version. For more information about Alpine images: gliderlabs/docker-alpine#136
Add tzdata so we can use the environment variable TZ to set a local timezone. Alpine lacks the package tzdata. Also bump version. For more information about Alpine images: gliderlabs/docker-alpine#136
This Work like a charm however, I simply extracted timezone file for my timezone and did |
It works, Thank you very much. (Node 12.14.0 Alpine) |
As the wiki said: https://wiki.alpinelinux.org/wiki/Setting_the_timezone You can now remove the other timezones using "apk del tzdata" But it doesn't work after "apk del tzdata"
The date is stil UTC datetime. |
@kzhui125 If you like to use ENV don't use ENV named TZ. FROM alpine:3.11 ARG ARG_TZ='Europe/Brussels' ENV ENV_TZ ${ARG_TZ} RUN apk upgrade --update CMD ["sh"] docker build --force-rm -t tz_test . |
If you have the timezone configured in the host system you can mount these volumes without installing
|
Referring to the previous comment: Some want to save space or do not have the option to install packages in their use case, so this worked for me and maybe it is helpful for others as well:
|
the date command still shows UTC |
@mihalycsaba Tried again, looks like i had TZ also set, sorry to have confused you. This works for me:
|
Fucking hell lets end the suffer now and forever here is my solution to this simple but teethgrinding problem: RUN apk add --no-cache tzdata
ENV TZ=Europe/Berlin
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime |
Thx! |
Somewhat related: If you set the localtime mount AND the TZ ENV variable, then Alpine I guess cries and reverts to UTC. If you ONLY use the /etc/localtime mount without the TZ ENV, then all is good. |
I tried many methods, but it still showed UTC. I tried three methods as follows:
1 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2 RUN echo "Asia/Shanghai" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
3 ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
I wrote these commands in the Dockerfile respectively, none of them did work.
Could you tell me how to set the timezone please? Thanks very much
The text was updated successfully, but these errors were encountered: