title: jenkins in docker - how to change timezone
body: <p>Question:</p>
  
  <ul>
  <li>How do I set the timezone in jenkins in a docker container so that when you reboot the server it retains the setting?</li>
  </ul>
  
  <p>So i'm running RHEL 7 on AWS with docker and jenkins (<a href="https://hub.docker.com/r/jenkinsci/blueocean/" rel="noreferrer">https://hub.docker.com/r/jenkinsci/blueocean/</a>).</p>
  
  <p>This article talks about how to change the timezone
  <a href="https://wiki.jenkins.io/display/JENKINS/Change+time+zone" rel="noreferrer">https://wiki.jenkins.io/display/JENKINS/Change+time+zone</a></p>
  
  <p>essentially two ways</p>
  
  <ol>
  <li>run System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/New_York') in the script console which works but if you reboot the server or jenkins it reverts back</li>
  <li>add it to /etc/sysconfig/jenkins, unfortunately that directory does not exist as it's running in a container</li>
  </ol>
  
  <p>However i have created a volume for the settings folder this way</p>
  
  <pre><code>docker run -d -p 8080:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkinsci/blueocean 
  </code></pre>
  
  <p>this makes the home directory "jenkins-blue"</p>
  
  <p>the directory listing is </p>
  
  <pre><code>4 -rw-r--r--.   1 &lt;omitted user&gt;  1647 Feb 27 17:00 config.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;  3982 Feb 27 16:57 copy_reference_file.log
  4 -rw-r--r--.   1 &lt;omitted user&gt;   966 Feb 27 17:04 credentials.xml
  0 drwxr-xr-x.   3 &lt;omitted user&gt;    16 Feb 27 17:06 fingerprints
  4 -rw-r--r--.   1 &lt;omitted user&gt;   156 Feb 27 16:57 hudson.model.UpdateCenter.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;  1230 Feb 27 17:07 hudson.plugins.emailext.ExtendedEmailPublisher.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;   370 Feb 27 16:58 hudson.plugins.git.GitTool.xml
  4 -rw-------.   1 &lt;omitted user&gt;  1712 Feb 27 16:57 identity.key.enc
  0 drwxr-xr-x.   2 &lt;omitted user&gt;    41 Feb 27 16:57 init.groovy.d
  4 -rw-r--r--.   1 &lt;omitted user&gt;    94 Feb 27 16:58 jenkins.CLI.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;     7 Feb 27 17:00 jenkins.install.InstallUtil.lastExecVersion
  4 -rw-r--r--.   1 &lt;omitted user&gt;     7 Feb 27 17:00 jenkins.install.UpgradeWizard.state
  4 -rw-r--r--.   1 &lt;omitted user&gt;   183 Feb 27 17:00 jenkins.model.JenkinsLocationConfiguration.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;   171 Feb 27 16:57 jenkins.telemetry.Correlator.xml
  0 drwxr-xr-x.   3 &lt;omitted user&gt;    18 Feb 27 17:00 jobs
  0 drwxr-xr-x.   4 &lt;omitted user&gt;    37 Feb 27 16:58 logs
  4 -rw-r--r--.   1 &lt;omitted user&gt;   907 Feb 27 16:58 nodeMonitors.xml
  0 drwxr-xr-x.   2 &lt;omitted user&gt;     6 Feb 27 16:58 nodes
  20 drwxr-xr-x. 106 &lt;omitted user&gt; 16384 Feb 27 16:59 plugins
  4 -rw-r--r--.   1 &lt;omitted user&gt;   129 Feb 28 17:35 queue.xml
  4 -rw-r--r--.   1 &lt;omitted user&gt;    64 Feb 27 16:57 secret.key
  0 -rw-r--r--.   1 &lt;omitted user&gt;     0 Feb 27 16:57 secret.key.not-so-secret
  4 drwx------.   4 &lt;omitted user&gt;  4096 Feb 27 17:14 secrets
  0 drwxr-xr-x.   2 &lt;omitted user&gt;   182 Feb 27 16:59 updates
  0 drwxr-xr-x.   2 &lt;omitted user&gt;    24 Feb 27 16:58 userContent
  0 drwxr-xr-x.   3 &lt;omitted user&gt;    57 Feb 27 17:00 users
  4 drwxr-xr-x.  11 &lt;omitted user&gt;  4096 Feb 27 16:57 war
  0 drwxr-xr-x.   2 &lt;omitted user&gt;     6 Feb 27 16:58 workflow-libs
  0 drwxr-xr-x.   4 &lt;omitted user&gt;    34 Feb 27 17:06 workspace
  </code></pre>