8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Docker用 Jenkins をTimezone JSTで稼働させるDockerfile

Last updated at Posted at 2018-02-18

Dockerfile

Docker 初心者の私がお勉強がてら Jenkins のタイムゾーンを JST(Asia/Tokyo) にする DockerFile を書いてみた。
https://hub.docker.com/r/k1tajima/jenkins_tzjst/~/dockerfile/

FROM jenkins/jenkins:lts
LABEL maintainer="https://qiita.com/k1tajima"

# set timezone for Java runtime arguments
ENV JAVA_OPTS=-Duser.timezone=Asia/Tokyo

# set timezone for OS by root
USER root
RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

# drop back to the regular jenkins user - good practice
USER jenkins

内容はわかってしまえば簡単。

  • JAVA_OPTS で JavaVM 起動時にタイムゾーンを指定
  • OS のタイムゾーンも合わせて変更する時は USER root してから変更

その他のノウハウ

  • Docker Hub 上で official と付記されている Docker Image: jenkins は廃止されている。
    Full Description の先頭にも DEPRECATION NOTICE と明記されている。
  • 他にも類似のイメージが散見されるが、現時点で Jenkins Community によって公式メンテされている Docker Image は
    jenkins/jenkins とのこと。
  • この Docker Image では docker exec -it でコンテナにログインしても sudo できないようになっている(README.md 参照)。
    なので、root 権限が必要な変更は Dockerfile を用意して対処しておくのが得策。
8
8
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
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?