Docker is not copying unzipped files

Found a strange issue today, COPY fails when i try to copy unzipped files after docker unzip instruction. Locally this works fine, however it fails in gitlab pipeline.

Dockerfile

FROM caapim/gateway:10.0.00

ARG API_NAME=gateway

USER root
# Install awscli
RUN yum -y update && \
    yum clean all && \ 
    yum -y install awscli

# Install newrelic
RUN mkdir -p /opt/newrelic/extensions && \
    curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip && \
        unzip newrelic-java.zip

#Copy newrelic specific files in /opt/newrleic/newrelic.jar
RUN ls newrelic/
#COPY ./newrelic/newrelic.jar /opt/newrelic/newrelic.jar
ADD ./newrelic/newrelic.jar /opt/newrelic/newrelic.jar

Gitlab pipeline logs

Step 6/18 : RUN mkdir -p /opt/newrelic/extensions &&     curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip &&         unzip newrelic-java.zip
 ---> Running in 9d1d1671cb48
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17.8M  100 17.8M    0     0  40.1M      0 --:--:-- --:--:-- --:--:-- 40.2M
Archive:  newrelic-java.zip
   creating: newrelic/
  inflating: newrelic/LICENSE        
  inflating: newrelic/THIRD_PARTY_NOTICES.md  
  inflating: newrelic/newrelic.jar   
  inflating: newrelic/extension.xsd  
  inflating: newrelic/newrelic.yml   
  inflating: newrelic/extension-example.xml  
  inflating: newrelic/newrelic-api.jar  
  inflating: newrelic/newrelic-api-sources.jar  
  inflating: newrelic/newrelic-api-javadoc.jar  
Removing intermediate container 9d1d1671cb48
 ---> 4d7c05a4e42f
Step 7/18 : RUN ls newrelic/
 ---> Running in 2c01dd0f64c7
extension-example.xml
extension.xsd
LICENSE
newrelic-api.jar
newrelic-api-javadoc.jar
newrelic-api-sources.jar
newrelic.jar
newrelic.yml
THIRD_PARTY_NOTICES.md
Removing intermediate container 2c01dd0f64c7
 ---> a46648ac1aa9
Step 8/18 : ADD ./newrelic/newrelic.jar /opt/newrelic/newrelic.jar
Service 'gateway' failed to build : ADD failed: stat /var/lib/docker/tmp/docker-builder027083691/newrelic/newrelic.jar: no such file or directory
Removing network build_default
Network build_default not found.

Note: I have removed few instruction and add some for RCA.



Read more here: https://stackoverflow.com/questions/67943719/docker-is-not-copying-unzipped-files

Content Attribution

This content was originally published by SudhirKumar at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: