I have the following Dockerfile:
FROM node:alpine
ENV HUGO_VERSION 0.26
ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux-64bit
# Install node
RUN apk add --update \
git py-pygments tar \
&& rm -rf /var/cache/apk/*
# Download and Install hugo
ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /tmp/${HUGO_BINARY}.tar.gz
RUN tar xzf /tmp/${HUGO_BINARY}.tar.gz -C /usr/local/bin/ \
&& rm /tmp/${HUGO_BINARY}.tar.gz
and I got:
tar (child): /tmp/hugo_0.26_linux-64bit.tar.gz: Cannot open: No such file or directory
I found a StackExchange thread with the same problem & understand from Docker ADD documentation that
you cannot
ADD ../something /something, because the first step of adocker buildis to send the context directory (and subdirectories) to the docker daemon.
However, I read it carefully several times that
If
<src>is a URL and<dest>does not end with a trailing slash, then a file is downloaded from the URL and copied to<dest>.If
<src>is a URL and<dest>does end with a trailing slash, then the filename is inferred from the URL and the file is downloaded to<dest>/<filename>.
and in my case I don't have trailing slash. I tried setting the <src> to /tmp/ like this
ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /tmp/
RUN tar xzf /tmp/${HUGO_BINARY}.tar.gz -C /usr/local/bin/ \
&& rm /tmp/${HUGO_BINARY}.tar.gz
I got:
tar (child): /tmp/hugo_0.26_linux-64bit.tar.gz: Cannot open: No such file or directory
I'm confused. Did I miss something? I'm using macOS 10.12.6 with
Docker version 17.06.0-ce, build 02c1d87
docker-compose version 1.14.0, build c7bdf9e
docker-machine version 0.12.0, build 45c69ad