Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "unzip: short read" when I try to build an image from Dockerfile?

From Spring Microservices in Action book: I am trying to use the Docker Maven Plugin to build a docker image for deploy a Java microservice as Docker container to the cloud.

Dockerfile:

FROM openjdk:8-jdk-alpine
RUN mkdir -p /usr/local/configserver
ADD jce_policy-8.zip /tmp/
RUN unzip /tmp/jce_policy-8.zip && \
    rm /tmp/jce_policy-8.zip && \
    yes | cp -v /tmp/UnlimitedJCEPolicyJDK8/*.jar /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/
ADD @[email protected] /usr/local/configserver/
ADD run.sh run.sh
RUN chmod +x run.sh
CMD ./run.sh

Output related to step 4 in Dockerfile:

...

---> Using cache
---> dd33d4c12d29
Step 4/8 : RUN unzip /tmp/jce_policy-8.zip && rm /tmp/jce_policy-8.zip && yes | cp -v /tmp/UnlimitedJCEPolicyJDK8/*.jar /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/

---> Running in 1071273ceee5
Archive:  /tmp/jce_policy-8.zip
unzip: short read

Why do I get unzip: short read when I try to build the image?

like image 905
lcnicolau Avatar asked Feb 06 '19 00:02

lcnicolau


1 Answers

Maybe it is related to the fact that the unzip command in alpine is provided busybox and not the standard unzip tool.

Busybox do have bugs related to this error: https://bugs.busybox.net/show_bug.cgi?id=8821

Here is a related issue with more details: https://github.com/wahern/luaossl/issues/103

As a workaround installing the standard unzip command should work.

like image 132
mickours Avatar answered Oct 07 '22 01:10

mickours