💻 Multi-arch, 📦 Small, 🔗 single binary, 🌐 Universal ➡ ⚡ Extreme portability
Install and run common programs without any package manager or compilation.
- Docker image provided (images)
- Single file download available (releases)
- Support multiple CPU architectures
- Very small executable (less than 1MB)
- Safe to use in scratch or distroless image
You can be freed from worrying about program installation inside CI or Docker image size and limitations comes from libc!
For example gnu-tar:
wget -O gnu-tar "https://github.com/isac322/static-bin/releases/download/gnu-tar/$(uname -m)"
chmod +x gnu-tar
gnu-tar --help
if you use alpine linux along side with apk
You can also use cat /etc/apk/arch
instead of uname -m
.
wget -O gnu-tar "https://github.com/isac322/static-bin/releases/download/gnu-tar/$(cat /etc/apk/arch)"
FROM ghcr.io/isac322/gnu-tar:latest as gnu-tar
# `scratch` can also be used instead of `distroless/static`
FROM gcr.io/distroless/static
# you can use `tar` inside this stage (`tar` will be located on `/usr/local/bin/tar`)
COPY --from=gnu-tar / /
# not required; usage example
ENTRYPOINT ["tar"]
You can check the detailed usages for each executable file in Supported binaries.
Wikipedia: Static build
Reddit: Static and Dynamic binaries?
TL;DR; Single file & Distribution agnostic (e.g. you can use same file in Debian based or Alpine based linux)
When you compile a program without specific options, you will get a dynamic binary that does not contains external binaries (so called .so files).
So OS must load those external binaries when you launch dynamic binary from filesystem.
On the other hand, static binary, copy all external binaries into single file.
So you do not have to install external libraries, just download and execute it.
⚠ Static binaries depends on OS and CPU architecture.
Usually static binaries are bigger than dynamic binaries because of its nature. But we can (1) remove unused parts from binary using strip, (2) compress binary using UPX.