Docker Timezone in Ubuntu 16.04 Image

前端 未结 10 1773
借酒劲吻你
借酒劲吻你 2020-12-13 10:40

I have created a Docker container using the Ubuntu 16.04 image.

docker run -it -d --name containername -v /var/www/public --privileged ubuntu
10条回答
  •  情书的邮戳
    2020-12-13 10:59

    My issue has been solved with this very simple solution (https://serverfault.com/a/826222) : Add timezone in environment variable.

    The command is docker run -e TZ=Europe/Amsterdam ...

    Or, using docker-compose, like I do :

    version: '3'
    services:
        web:
            build: ./app
            ports:
                - ...
            volumes:
                - ...
            environment:
                - TZ=Europe/Paris
    

    In my case, no more tzdata needed, or volume share with /etc/timezone & /etc/localtime.
    Hope it helps !

提交回复
热议问题