Docker Timezone in Ubuntu 16.04 Image

前端 未结 10 1740
借酒劲吻你
借酒劲吻你 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:53

    If you use docker-compose, just add one line to your docker-compose.yml file.

    version: '3'

    services:
      ubuntu-local:
        image: ubuntu:16.04
        restart: on-failure
        command: python3 run_my_code.py
        working_dir: /code
        volumes:
          - ./code:/code
          - /etc/localtime:/etc/localtime:ro   # <--add this line to set timezone
        environment:
          - PYTHONUNBUFFERED=1
    

提交回复
热议问题