Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker ADD doesn't extract file

I'm trying to download a specific Node version and copy the binary from the extracted tar.xz, but it doesn't look like ADD actually extracts the file.

This is my Dockerfile:

FROM arm32v7/debian:stretch-slim

ENV nodever="v6.10.0"
ADD https://nodejs.org/dist/${nodever}/node-${nodever}-linux-armv7l.tar.xz /
COPY /node-${nodever}-linux-armv7l/bin/node /

RUN cat /etc/issue && \
\
apk update &&  \
apk add \
    dnsmasq \
    hostapd \
    iptables

RUN mkdir app
ADD start.sh /app/start.sh
ADD server /app/server

ADD configs/hostapd.conf /etc/hostapd.conf
ADD configs/dnsmasq.conf /etc/dnsmasq.conf

WORKDIR /app
CMD ["/app/start.sh"]

but running docker -v build yields this error:

Sending build context to Docker daemon  9.728kB
Step 1/12 : FROM arm32v7/debian:stretch-slim

---> 1510cdc40eca
Step 2/12 : ENV nodever "v6.10.0"

---> Using cache
---> 1ca3d2f72a3c
Step 3/12 : ADD https://nodejs.org/dist/${nodever}/node-${nodever}-linux-armv7l.tar.xz /
Downloading   8.34MB/8.34MB

---> a1fefb9bda66
Step 4/12 : COPY /node-${nodever}-linux-armv7l/bin/node /
COPY failed: stat /var/lib/docker/tmp/docker-builder233292954/node-v6.10.0-linux-armv7l/bin/node: no such file or directory

I've tried running RUN ls / which shows that it has downloaded the archive but it isn't extracted.

like image 266
Nathan Prins Avatar asked Nov 26 '17 22:11

Nathan Prins


1 Answers

This is documented:

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

Notice the emphasis on "local".

This was actually changed and reverted at some point, so it's unlikely this will ever change again.

like image 60
tne Avatar answered Sep 24 '22 19:09

tne