tar: can't create directory 'sqljdbc_7.2/': Permission denied tar: can't open 'sqljdbc_7.2/': Is a directory

by Luis Valencia   Last Updated September 11, 2019 10:26 AM

I am trying to copy a file and then uncompress it in a docker file with these comands.

#MSSQL SERVER JDBC DRIVER INSTALL
COPY sqljdbc_7.2.2.0_enu.tar.gz /camunda/lib/
WORKDIR /camunda/lib
RUN tar -xf sqljdbc_7.2.2.0_enu.tar.gz
ENV CLASSPATH=${CLASSPATH}:/tmp/sqljdbc_7.2/enu/mssql-jdbc-7.2.2.jre11.jar
ARG CLASSPATH=${CLASSPATH}:/tmp/sqljdbc_7.2/enu/mssql-jdbc-7.2.2.jre11.jar
RUN echo $CLASSPATH

but i get this error:

tar: can't create directory 'sqljdbc_7.2/': Permission denied tar: can't open 'sqljdbc_7.2/': Is a directory

Tags : linux docker tar


Answers 1


try to use ADD this will untar the file for you:

ADD sqljdbc_7.2.2.0_enu.tar.gz /camunda/lib/

and remove the following from Dockerfile:

WORKDIR /camunda/lib
RUN tar -xf sqljdbc_7.2.2.0_enu.tar.gz

From The Docs:

If is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory.

LinPy
LinPy
September 11, 2019 10:20 AM

Related Questions


Updated November 26, 2018 14:26 PM

Updated December 30, 2018 11:26 AM

Updated February 06, 2019 11:26 AM

Updated December 10, 2017 18:26 PM

Updated March 30, 2017 15:26 PM