zip and unzip: command not found and Archive Errors
The zip and unzip binaries are separate packages missing from many minimal CI images, and most extraction failures trace to a file that is not really a zip.
A pipeline that works locally can fail in a container purely because zip or unzip is absent, or because a download saved an error page under a .zip name. Both are quick to diagnose.
What it does
zip (the archiver) and unzip (the extractor) ship as distinct packages and are not part of every base image, especially slim or distroless ones. Installing the right package per distro restores the command. Once installed, the remaining failures are almost always a missing path or a file that is not a valid zip.
Common usage
# Debian / Ubuntu
apt-get update && apt-get install -y zip unzip
# Alpine
apk add --no-cache zip unzip
# confirm the file is a real zip before extracting
file artifact.zip && unzip -t artifact.zipInstall per distro
| Image | Command |
|---|---|
| Debian / Ubuntu | apt-get install -y zip unzip |
| Alpine | apk add zip unzip |
| RHEL / Amazon Linux | yum install -y zip unzip |
| Fedora | dnf install -y zip unzip |
In CI
If you cannot add a package, alternatives are usually present: Python can create and extract zips with python -m zipfile, and most runners have tar for .tar.gz when a zip is not strictly required. The GitHub Actions upload-artifact action zips for you, so you may not need the zip binary at all just to upload artifacts. When a download "succeeds" but unzip rejects it, inspect the file with file or head: it is often an HTML error page or a redirect saved under the .zip name.
Common errors in CI
"zip: command not found" or "unzip: command not found" means the package is absent; install it or switch tools. "cannot find or open <name>, <name>.zip or <name>.ZIP" means unzip tried three name variants and found none, so the path is wrong or the previous step produced no file. "End-of-central-directory signature not found" (and "cannot find zipfile directory") almost always means the file is truncated, corrupt, or not a zip; check the download HTTP status. AES-encrypted archives need a tool like 7-Zip since stock Info-ZIP unzip cannot decrypt AES. In distroless or scratch images there is no package manager, so build the archive in an earlier stage that has zip.