Centos7(64bit)上で、dockerを使いコンテナを作成していますが
コンテナのtimezoneをUTCからJSTへ変更するには、どのようにすればいいでしょうか。
ホスト側のtimezoneはJSTです。
http://dosukoikoi.sub.jp/blog/archives/316
上記を参考にし、docker-compose.ymlのenvironmentを「TZ=Asia/Tokyo」にしましたが
GMTとなり、だめでした。
何もしなければ、コンテナのtimezoneはUTCです。
docker-compose.yml
version: '3' services: app: build: context: . dockerfile: ./Dockerfile ports: - 127.0.0.1:3000:3000 # localhost only by default links: - mongo:mongo - redis:redis - elasticsearch:elasticsearch depends_on: - mongo - redis - elasticsearch environment: - "TZ=Asia/Tokyo" - MONGO_URI=mongodb://mongo:27017/growi - REDIS_URL=redis://redis:6379/growi - ELASTICSEARCH_URI=http://elasticsearch:9200/growi - PASSWORD_SEED=changeme # - FILE_UPLOAD=local # activate this line if you use local storage of server rather than AWS # - MATHJAX=1 # activate this line if you want to use MathJax # - PLANTUML_URI=http:// # activate this line and specify if you use your own PlantUML server rather than public plantuml.com command: "dockerize -wait tcp://mongo:27017 -wait tcp://redis:6379 -wait tcp://elasticsearch:9200 -timeout 60s npm run server:prod" volumes: - growi_data:/data mongo: image: mongo:3.4 volumes: - mongo_configdb:/data/configdb - mongo_db:/data/db redis: image: redis:3-alpine volumes: - redis_data:/data elasticsearch: image: elasticsearch:5.3-alpine environment: - "ES_JAVA_OPTS=-Xms256m -Xmx256m" # increase amount if you have enough memory - "TZ=Asia/Tokyo" command: - sh - -c - "./bin/elasticsearch-plugin list | grep -q analysis-kuromoji || ./bin/elasticsearch-plugin install analysis-kuromoji; ./bin/elasticsearch-plugin list | grep -q analysis-icu || ./bin/elasticsearch-plugin install analysis-icu; /docker-entrypoint.sh elasticsearch" volumes: - es_data:/usr/share/elasticsearch/data - es_plugins:/usr/share/elasticsearch/plugins - ./esconfig:/usr/share/elasticsearch/config volumes: growi_data: mongo_configdb: mongo_db: redis_data: es_data: es_plugins:
Dockerfile
FROM weseek/growi:3 ENV APP_DIR /opt/growi # install dockerize ENV DOCKERIZE_VERSION v0.5.0 RUN apk add --no-cache --virtual .dl-deps curl \ && curl -SL https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | tar -xz -C /usr/local/bin \ && apk del .dl-deps WORKDIR ${APP_DIR} # install plugins if necessary # ;; # ;; NOTE: In GROWI v3 and later, # ;; 2 of official plugins (growi-plugin-lsx and growi-plugin-pukiwiki-like-linker) # ;; are now included in the 'weseek/growi' image. # ;; Therefore you will not need following lines except when you install third-party plugins. # ;; #RUN echo "install plugins" \ # && yarn add \ # growi-plugin-XXX \ # growi-plugin-YYY \ # && echo "done." # you must rebuild if install plugin at least one # RUN npm run build:prod
回答1件
あなたの回答
tips
プレビュー