


For alpine based images, it does not work: $ docker run alpine:latest date However, above works only if the image is fedora based.

$ docker run -e TZ=Asia/Kolkata ubuntu:latest date For example: $ docker run ubuntu:latest date The timezone of a container can be set using an environment variable in the docker container when it is created. We’ll discuss some of these in this post. Unfortunately, the option to control timezone in the containers / pods can vary, depending upon your container engine, the type of the OS in the container image, the versions of the container engines and platform used to run container engines. Depending on your application and sometimes to meet certain audit requirements, it might be necessary for you to control the timezone in the containers. This means that your container running in London could be reporting that it is running in New York or Singapore, depending on where the image was built. Once the image is pulled, the container engine just launches the container based on the hardcoded time zone. The container image is usually built with a hardcoded link from /etc/localtime to one timezone. When container engines like Podman, Docker or CRI-O run containers, they pull down the specified OCI image from a container registry. By default, Docker and Container uses UTC timezone.
