tar: Cannot read: Is a directory in docker

docker, tar

Solution

After running an intermediate commit of the docker image I could see, that `/archive.tar.gz` indeed is a directory. This means that docker automatically extracts archives when adding them during image creation.

Now I could also find this documented in docker documentation.

(edit: files, e.g. `.sql.gz`, are not decompressed on adding)

Problem

I want to add an archive (`.tar.gz`) and unpack it during image creation using a Dockerfile. ``` ADD archive.tar.gz /archive.tar.gz RUN tar xzf archive.tar.gz ``` When I want to unpack the archive, I get following message: ``` tar: /archive.tar.gz: Cannot read: Is a directory tar: At beginning of tape, quitting now tar: Error is not recoverable: exiting now ``` which doesn't make any sense to me, since the file `archive.tar.gz` is not a directory.

Original source