I have the following Dockerfile:FROM node:alpineENV HUGO_VERSION 0.26ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux-64bit# Install nodeRUN apk add --update \        git py-pygments tar \        && rm -rf /var/cache/apk/*# Download and Install hugoADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /tmp/${HUGO_BINARY}.tar.gzRUN tar xzf /tmp/${HUGO_BINARY}.tar.gz -C /usr/local/bin/ \        && rm /tmp/${HUGO_BINARY}.tar.gzand I got:tar (child): /tmp/hugo_0.26_linux-64bit.tar.gz: Cannot open: No such file or directoryI found a StackExchange thread with the same problem & understand from Docker ADD documentation that you cannot ADD ../something /something, because the first step of a docker build is 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 thisADD 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.gzI got:tar (child): /tmp/hugo_0.26_linux-64bit.tar.gz: Cannot open: No such file or directoryI'm confused. Did I miss something? I'm using macOS 10.12.6 with Docker version 17.06.0-ce, build 02c1d87docker-compose version 1.14.0, build c7bdf9edocker-machine version 0.12.0, build 45c69ad
Dockerfile: ADD where  is URL creates a directory instead of the downloaded file
docker
I modified your Dockerfile to add an ls -Rlh /tmp before the tar and saw this:Step 5/5 : RUN ls -Rlh /tmp/ && tar xzf /tmp/${HUGO_BINARY}.tar.gz -C /usr/local/bin/         && rm /tmp/${HUGO_BINARY}.tar.gz ---> Running in deea1f3a4b1a/tmp/:total 4drwxr-xr-x    2 root     root        4.0K Aug 10 05:25 hugo_0.26_linux-64bit.tar.gz/tmp/hugo_0.26_linux-64bit.tar.gz:total 11976-rw-r--r--    1 root     root       10.2K Jun 17 08:06 LICENSE.md-rw-r--r--    1 root     root        6.2K Jul 18 08:50 README.md-rwxr-xr-x    1 root     root       11.7M Aug  7 07:09 hugoSo, it seems, Docker recognised that the file is a tarball and did the extraction for you. You could probably do just:# Download and Install hugoADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /usr/local/bin/Which gives me this:Step 5/5 : RUN ls -Rlh /usr/local/bin/ ---> Running in 6f6cabfbbde8/usr/local/bin/:total 47596-rw-r--r--    1 root     root       10.2K Jun 17 08:06 LICENSE.md-rw-r--r--    1 root     root        6.2K Jul 18 08:50 README.md-rwxr-xr-x    1 root     root       11.7M Aug  7 07:09 hugo-rwxr-xr-x    1 root     root       34.8M Jul 21 18:20 nodelrwxrwxrwx    1 root     root          38 Jul 21 18:20 npm -> ../lib/node_modules/npm/bin/npm-cli.jslrwxrwxrwx    1 root     root          38 Jul 21 18:20 npx -> ../lib/node_modules/npm/bin/npx-cli.jslrwxrwxrwx    1 root     root          18 Jul 21 18:21 yarn -> /opt/yarn/bin/yarnlrwxrwxrwx    1 root     root          18 Jul 21 18:21 yarnpkg -> /opt/yarn/bin/yarnThis does seem to contradict the docs:If <src> is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a  directory. Resources from remote URLs are not decompressed.