Download a container image as a plain rootfs tarball for Hetzner installimage.
Pure shell (curl + jq). Fetches from OCI/Docker registries and outputs a single .tar[.gz] with top-level bin, etc, usr, root — the format Hetzner installimage expects. No Docker daemon required.
curl -sSL https://raw.githubusercontent.com/mystack-cloud/hetzner-download-image.sh/main/get.hetzner-download-image.sh | sh -sOr with wget:
wget -qO- https://raw.githubusercontent.com/mystack-cloud/hetzner-download-image.sh/main/get.hetzner-download-image.sh | sh -sThis installs hetzner-download-image.sh into ~/.local/bin and adds it to PATH. To skip modifying your shell config:
SKIP_PATH=1 curl https://get.hetzner-download-image.sh | sh -sOverride install directory:
INSTALL_DIR=/usr/local/bin curl https://get.hetzner-download-image.sh | sh -sInstall from a specific URL (e.g. GitHub raw):
SCRIPT_URL=https://raw.githubusercontent.com/OWNER/REPO/main/hetzner-download-image.sh curl https://get.hetzner-download-image.sh | sh -s- curl – HTTP
- jq – JSON
- tar – archives
- gzip – optional (for
.tar.gzoutput)
hetzner-download-image.sh [OPTIONS] IMAGE [OUTPUT_DIR]
# Examples
hetzner-download-image.sh ghcr.io/myorg/hetzner-images/debian-13:latest
hetzner-download-image.sh -o /root/local_images -u user:token ghcr.io/myorg/debian-13:latest
hetzner-download-image.sh --no-gzip -o ./images docker.io/library/alpine:3.19| Option | Description |
|---|---|
-o DIR |
Output directory (default: current dir). Filename is always <name>-<arch>-<tag>.tar[.gz] where <name> is the last path component of the image repo (e.g. debian-13-amd64-latest.tar.gz). |
--no-gzip |
Write uncompressed .tar |
-u USER[:PASSWORD] |
Registry credentials (required for private images) |
-q |
Quiet |
-h, --help |
Show help |
The script writes a single rootfs tarball into the output directory. The file name is derived from the image (last repo path component), host architecture, and tag (e.g. debian-13-amd64-latest.tar.gz by default, or debian-13-amd64-latest.tar with --no-gzip). Point installimage’s config at this file (e.g. in config.cfg).
[REGISTRY/]REPOSITORY[:TAG|@sha256:DIGEST]- Default registry: Docker Hub (
registry-1.docker.io) - Default tag:
latest - For GitHub Container Registry use
-u USER:ghp_TOKENorGITHUB_TOKEN.
For multi-arch images (manifest lists), the script picks the manifest matching the host architecture (uname -m → OCI: amd64, arm64, arm, 386, ppc64le, s390x, riscv64). If no match is found, the first manifest in the list is used.
MIT. See LICENSE.