docker - Permissions error running Java Timezone Updater JAR in Dockerfile -


i have standard java image dependencies added in i'm writing dockerfile on top of. here's i'm having problem in dockerfile:

run java run ["/usr/bin/java", "-jar", "tzupdater.jar", "-v", "-l"] 

i thought every dockerfile command run root? when try build dockerfile, i'm running permissions issue happened in local environment when forgot run jar sudo:

$ docker build -t container-w-tz-update . uploading context 1.122 gb uploading context  step 0 : company/java-img-with-dependencies:1.0  ---> 0101010101 ... step 3 : run java  ---> running in 0101010101 /usr/bin/java  ---> 0101010101 step 4 : run ["/usr/bin/java", "-jar", "tzupdater.jar", "-v", "-l"]  ---> running in 0101010101 java.vendor: sun microsystems inc. java.version: 1.6.0_45 tzupdater version 2.1.1-b01 downloaded file /tmp/tz.tmp/tzdata.tar.gz downloaded file /tmp/tz.tmp/sha512hash failed. cant rename {0} {1}. com.sun.tools.tzupdater.tzruntimeexception: com.sun.tools.tzupdater.tzruntimeexception: cant rename {0} {1}.  caused by: com.sun.tools.tzupdater.tzruntimeexception: cant rename {0} {1}.         @ com.sun.tools.tzupdater.timezoneupdater.update(timezoneupdater.java:301)         @ com.sun.tools.tzupdater.timezoneupdater.run(timezoneupdater.java:249)         @ com.sun.tools.tzupdater.timezoneupdater.main(timezoneupdater.java:643) 2017/04/05 22:20:23 command [/usr/bin/java -jar tzupdater.jar -v -l] returned non-zero code: 1 

i able run utility sudo on local exact same version of java no issues. when tried run locally without sudo, received same error. thoughts?

(this more comment message length beyond comment limit, leave here answer other people can maybe give more useful info based on i've done.)

seems it's unresolved issue, reproduced problem image enoniccloud/java6 running root user, tried docker run -it --privileged ... run manually not help. tried jdk8 base image alpine:3.3 failed with:

downloaded file /tmp/tz.tmp/sha512hash renaming /opt/jdk1.8.0_91/jre/lib/tzdb.dat /opt/jdk1.8.0_91/jre/lib/tzdb.dat.tzdata2016a failed. cant rename {0} {1}. validating : tzdata2017b validation complete jre updated version : tzdata2017b 

i searched , info found follows:

before find root cause issue, think alternative way build image be:

  • download jdk tarball platform
  • untar it, setup java_home , path, run java -jar tzupdater.jar -v -l on host
  • build base image based on updated jdk, add image , setup environment variable java_home , path

hope helpful :-)


Comments