LoginSignup
8
10

More than 5 years have passed since last update.

docker-compose内の時刻を日本時間に変更する

Posted at

dockerを起動すると、デフォルトではUTC時間になってしまう。
docker-composeに設定する際、以下の数行を追加することで
日本時間に変更する事が可能

※元にしたファイルはredashのcomposeファイル

[作業前]docker-compose.production.yml
  nginx:
    image: redash/nginx:latest
    ports:
      - "443:443"
    depends_on:
      - server
    links:
      - server:redash
    logging:
      driver: "json-file"
      options:
        max-size: 3m
        max-file: "5"
    restart: always
[作業後]docker-compose.production.yml
  nginx:
    image: redash/nginx:latest
#-----------------------
# 以下追加
    volumes:
      - /etc/localtime:/etc/localtime:ro
    environment:
      TZ: Asia/Tokyo
#-----------------------
    ports:
      - "443:443"
    depends_on:
      - server
    links:
      - server:redash
    logging:
      driver: "json-file"
      options:
        max-size: 3m
        max-file: "5"
    restart: always

コンテナの落としあげをする事で日本時間に切り替わる。

8
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
10