Docker Community Forums

Share and learn in the Docker community.

Docker build is giving error when the java jar tries to rename the file

This is the erro part at my Dockerfile

COPY files/tzdata2016g.tar.gz.sha512 /tmp/tzdata2016g.tar.gz.sha512
COPY files/tzupdater.jar /tmp/tzupdater.jar
COPY files/tzdata2016g.tar.gz /tmp/tzdata2016g.tar.gz

RUN /usr/java/jdk/bin/java -jar /tmp/tzupdater.jar -l file:///tmp/tzdata2016g.tar.gz -v -f &&
chmod 755 /usr/java/jdk/jre/lib/tzdb.dat

When i run the docker build, getting the below error

`> Using file:///tmp/tzdata2016g.tar.gz as source for tzdata bundle.

java.home: /usr/java/jdk1.7.0_80/jre
java.vendor: Oracle Corporation
java.version: 1.7.0_80
tzupdater version 2.1.1-b01
JRE tzdata version: tzdata2015a
Downloaded file to /tmp/tz.tmp/tzdata.tar.gz
tzupdater tool would update with tzdata version: tzdata2016g
Downloaded file to /tmp/tz.tmp/sha512hash
Extracting files… done.
Renaming /usr/java/jdk1.7.0_80/jre/lib/zi to /usr/java/jdk1.7.0_80/jre/lib/zi.tzdata2015a
failed.
Cant rename {0} to {1}.
Exception in thread “main” com.sun.tools.tzupdater.TzRuntimeException: com.sun.tools.tzupdater.TzRuntimeException: Cant rename {0} to {1}.
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:662)
Caused by: com.sun.tools.tzupdater.TzRuntimeException: Cant rename {0} to {1}.
at com.sun.tools.tzupdater.TimezoneUpdater.update(TimezoneUpdater.java:301)
at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:249)
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:643)
The command ‘/bin/sh -c /usr/java/jdk/bin/java -jar /tmp/tzupdater.jar -l file:///tmp/tzdata2016g.tar.gz -v -f && chmod 755 /usr/java/jdk/jre/lib/tzdb.dat’ returned a non-zero code: 1`

When i enter the image and cd to the zi file location and do the follofing it works somehow inside the image

cd /usr/java/jdk1.7.0_80/jre/lib/zi

mv zi zi.bak

mv zi.bak zi

/usr/java/jdk/bin/java -jar /tmp/tzupdater.jar -l file:///tmp/tzdata2016g.tar.gz -v -f

I am confused about the reason of not being able to rename the directory during the docker build.

✗ docker -v
Docker version 1.12.3, build 6b644ec

I am using at MacOSx

Any idea why the java application is not able to rename the directory?