RepositoryShell
RU

rust-cross/rust-musl-cross

Docker images for compiling static Rust binaries using musl-cross

749stars
80forks
7issues
4views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: musl-libc

#1 Repository of the month

1
TINIX TRENDING·Topic: musl-cross

#1 Repository of the month

1
TINIX TRENDING·Topic: docker-image

#1 Repository of the month

rust-musl-cross

Docker Image Build Bors enabled

🚀 Help me to become a full-time open-source developer by sponsoring me on GitHub

Docker images for compiling static Rust binaries using musl-cross-make, inspired by rust-musl-builder

Prebuilt images

Currently we have the following prebuilt Docker images on Docker Hub, supports x86_64(amd64) and aarch64(arm64) architectures.

Rust toolchainCross Compile TargetDocker Image Tag
stableaarch64-unknown-linux-muslaarch64-musl
stablearm-unknown-linux-musleabiarm-musleabi
stablearm-unknown-linux-musleabihfarm-musleabihf
stablearmv5te-unknown-linux-musleabiarmv5te-musleabi
stablearmv7-unknown-linux-musleabiarmv7-musleabi
stablearmv7-unknown-linux-musleabihfarmv7-musleabihf
stablei586-unknown-linux-musli586-musl
stablei686-unknown-linux-musli686-musl
stableloongarch64-unknown-linux-muslloongarch64-musl
nightlymips-unknown-linux-muslmips-musl
nightlymips64-openwrt-linux-muslmips64-openwrt-musl
nightlymips64-unknown-linux-muslabi64mips64-muslabi64
nightlymips64el-unknown-linux-muslabi64mips64el-muslabi64
nightlymipsel-unknown-linux-muslmipsel-musl
nightlypowerpc64-unknown-linux-muslpowerpc64-musl
stablepowerpc64le-unknown-linux-muslpowerpc64le-musl
stableriscv64gc-unknown-linux-muslriscv64gc-musl
nightlys390x-unknown-linux-musls390x-musl
stablex86_64-unknown-linux-muslx86_64-musl

To use armv7-unknown-linux-musleabihf target for example, first pull the image:

docker pull ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf
# Also available on Docker Hub
# docker pull messense/rust-musl-cross:armv7-musleabihf

Then you can do:

alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf'
rust-musl-builder cargo build --release

This command assumes that $(pwd) is readable and writable. It will output binaries in armv7-unknown-linux-musleabihf. At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds.

Docker-convention alias tags

Several images are also published under Docker-convention tag names that match Docker's TARGETARCH build arg (e.g. amd64, arm64). The alias tag format is <TARGETARCH>-musl:

Primary tagAlias tag
aarch64-muslarm64-musl
x86_64-muslamd64-musl
i686-musl386-musl
loongarch64-muslloong64-musl
powerpc64-muslppc64-musl
powerpc64le-muslppc64le-musl
mips64-muslabi64mips64-musl
mips64el-muslabi64mips64le-musl
mipsel-muslmipsle-musl
riscv64gc-muslriscv64-musl

This lets multi-platform Dockerfiles use TARGETARCH directly without any explicit build args:

ARG TARGETARCH=amd64
FROM ghcr.io/rust-cross/rust-musl-cross:${TARGETARCH}-musl AS builder

Docker sets TARGETARCH automatically from the native runner platform, so the same docker buildx build --platform linux/amd64,linux/arm64 command selects the right image on each platform with no extra configuration.

Note: The arm variants (arm-musleabi, arm-musleabihf, armv7-musleabi, armv7-musleabihf, armv5te-musleabi) are not aliased because they all map to GOARCH=arm, making a single canonical arm-musl alias ambiguous.

How it works

rust-musl-cross uses musl-libc, musl-gcc with the help of musl-cross-make to make it easy to compile, and the new rustup target support.

Use beta/nightly Rust

Currently we install stable Rust by default, if you want to switch to beta/nightly Rust, you can do it by extending from our Docker image, for example to use beta Rust for target x86_64-unknown-linux-musl:

FROM ghcr.io/rust-cross/rust-musl-cross:x86_64-musl
RUN rustup update beta && \
    rustup target add --toolchain beta x86_64-unknown-linux-musl

Strip binaries

You can use the musl-strip command inside the image to strip binaries, for example:

docker run --rm -it -v "$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf musl-strip /home/rust/src/target/release/example

License

Licensed under The MIT License

Similar Projects

Discover other similar projects and AI models.

Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
RepositoryRust
static-web-server/static-web-server

A cross-platform, high-performance and asynchronous web server for static files-serving. ⚡

2.4k
Nov 28, 2026
RepositoryRust
farion1231/cc-switch

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

158.7k
Dec 2, 2026
RepositoryRust
tauri-apps/tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

113.4k
Dec 1, 2026
RepositoryRust
storytold/photocraft

PhotoCraft: An open-source photo editor written from scratch in pure Rust

82.7k
Dec 2, 2026
RepositoryTypeScript
toeverything/AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

81.6k
Dec 2, 2026
RepositoryRust
spacedriveapp/spacedrive

Spacedrive is an open source cross-platform file explorer, powered by a virtual distributed filesystem written in Rust.

39.6k
Nov 25, 2026
RepositoryTypeScript
nilbuild/developer-roadmap

Interactive roadmaps, guides and other educational content to help developers grow in their careers.

373.1k
Dec 1, 2026
RepositoryMarkdown
DigitalPlatDev/FreeDomain

Free domain registration and practical DNS learning resources for everyone.

209.9k
Aug 12, 2026