Skip to content

Commit 75c9485

Browse files
author
Tony Bussieres
committed
fix timezone
1 parent 9f66825 commit 75c9485

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

jenkins/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ RUN mkdir -p /opt/jenkins/data/
1313
RUN mv ~/jenkins.war /opt/jenkins
1414
RUN ln -s /opt/apache-maven-3.2.3 /opt/maven
1515
RUN ln -s /opt/jenkins/data/m2home /root/.m2
16+
ADD start.sh /opt/jenkins/start.sh
1617

1718

1819
EXPOSE 8080
1920

20-
CMD /usr/bin/java -Duser.timezone=${TZ} -jar /opt/jenkins/jenkins.war
21+
CMD /opt/jenkins/start.sh
2122

2223

jenkins/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ docker run --name "jenkinsdata" -v /opt/jenkins/data tianon/true
2323
## How to use Jenkins with the data container
2424

2525
```
26-
docker run -d -p 8080:8080 --name "jenkins" --volumes-from jenkinsdata -v /etc/timezone:/etc/timezone:ro codingtony/jenkins
26+
docker run -d -p 8080:8080 --name "jenkins" --volumes-from jenkinsdata -v /etc/localtime:/etc/localtime:ro -v /etc/sysconfig/clock:/etc/sysconfig/clock:ro codingtony/jenkins
2727
```
2828

2929
If you need to setup stuff in /opt/jenkins/data, you probably want to log to the image and update the configuration you will simply to this :
3030

3131
```
32-
docker run --rm -ti -p 8080:8080 --volumes-from jenkinsdata codingtony/jenkins bash
32+
docker run --rm -ti -p 8080:8080 --volumes-from jenkinsdata -v /etc/localtime:/etc/localtime:ro -v /etc/sysconfig/clock:/etc/sysconfig/clock:ro codingtony/jenkins bash
3333
```
3434

3535

jenkins/start.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
sed 's/ZONE.*="\(.*\)"$/\1/g' /etc/sysconfig/clock > /etc/timezone
3+
/usr/bin/java -jar /opt/jenkins/jenkins.war
4+

0 commit comments

Comments
 (0)