Container build environments
Container build environments provide fixed Solana and Agave toolchains for verified program builds. Each environment matches a release version and lets the verifier rebuild a program with the toolchain that was intended for that release. This reduces differences between a developer build and a later verification build.
System purpose
Reproducible program builds
The build system uses Docker to place the Rust compiler, Solana or Agave tools, and platform tools in one controlled environment. A versioned environment is selected from the program's Solana version, so historical programs can use an older toolchain while current programs use a newer one. The resulting program binary is then compared with the deployed program data on Solana. References: src/main.rs• L136-171, src/main.rs• L1441-1558
Versioned environment identity
An environment is identified by a Solana or Agave release such as v4.1.2. Its identity includes the release toolchain and a pinned Rust base image. The release tool package and platform-tool version can be shared by releases in one train while the environment still keeps its own release identity. These pins make a versioned environment a stable input to verification rather than a moving latest image. References: generate_dockerfiles.py• L75-138, docker/v4.2.0.Dockerfile#L1-L10, docker/v4.2.1.Dockerfile#L1-L11, docker/v4.2.2.Dockerfile#L1-L11, docker/v4.3.0.Dockerfile#L1-L10, README.md• L66-70
Environment selection
Project version signals
The verifier first looks for a Solana CLI version in the workspace metadata. If that value is not present, it reads the version of a Solana package from Cargo.lock. This supports programs that do not depend directly on the main Solana program package, while still giving the build a clear release target. References: src/main.rs• L949-975, src/main.rs• L1649-1681, README.md• L30-37
Image resolution
The resolved release version maps to a published image digest. The digest map is generated from published image tags and is included in the CLI so normal builds can use an exact image instead of a mutable tag. A caller can provide a custom base image when the catalog does not include a compatible release or when a project needs a special environment. References: src/main.rs• L951-975, src/image_config.rs• L1-9, update_image_whitelist.py• L45-73
The selection and build flow connects project metadata to the final binary as shown below.
flowchart TD
A[Program workspace] --> B[Read Solana version]
B --> C[Resolve versioned image digest]
C --> D[Run build in Docker]
D --> E[Produce program binary]
E --> F[Compare with deployed program data]
References: src/main.rs• L936-975 src/main.rs• L990-1115 src/main.rs• L1562-1606
Environment lifecycle
Dockerfile catalog
The Dockerfile catalog is the source-level record of supported release environments. Each versioned Dockerfile describes one release-specific build context. The catalog spans older Solana releases and newer Agave releases because verified builds must reproduce the toolchain used by programs from different points in the ecosystem's history. The current Agave 4.2.x environments share their build-tool train, while Agave 4.3.0 moves to the next platform-tool version.
References: generate_dockerfiles.py• L216-251 docker/v2.0.22.Dockerfile• L1-18 docker/v4.2.0.Dockerfile• L1-13 docker/v4.2.1.Dockerfile• L1-14 docker/v4.2.2.Dockerfile• L1-14 docker/v4.3.0.Dockerfile• L1-13
Dockerfile generation
The Dockerfile generation process turns upstream release data into catalog entries. It preserves the Rust version declared by each release and selects the matching installer and platform-tool setup. It also filters unsupported releases and refuses to create an environment when required version or integrity data is missing.
References: generate_dockerfiles.py• L148-212 generate_dockerfiles.py• L253-320 .github/…/generate_dockerfiles.yml• L1-51
Image publication
Published images use the solanafoundation/solana-verifiable-build repository with the release version as the image tag. The publishing workflows build from the matching catalog Dockerfile and create a build-provenance attestation. A change to a versioned Dockerfile therefore needs both a catalog review and publication of the image that the CLI will later resolve.
References: .github/…/publish_dockerfile.yaml• L41-67 .github/…/publish_all_dockerfiles.yaml• L21-42 .github/…/publish_all_dockerfiles.yaml• L80-99
Local image use
The image build and installation guide covers local image creation and use. The local path is useful when testing a catalog change or working with a custom image. The image configuration guide explains how the version-to-digest data stays aligned with published images.
References: build-all-images.sh• L1-20 src/main.rs• L990-1037 src/main.rs• L1144-1244
Verification relationship
Build and hash comparison
The container is only the build side of verification. The verifier mounts the source workspace into the selected environment, runs the release-compatible Solana build command, and hashes the produced program binary. It reads the deployed program data from the selected Solana network and accepts the result only when the two hashes match.
References: src/main.rs• L1011-1115 src/main.rs• L1562-1606 src/main.rs• L780-861
Verification record
After a successful match, the CLI can write the source repository, commit, build arguments, tool version, and deployment slot to the on-chain verification record. This record lets a later remote worker or user understand which source snapshot and build context produced the verified result. The image is therefore part of a wider evidence chain that links source, toolchain, binary, and deployed program.
References: src/solana_program.rs• L68-109 src/solana_program.rs• L315-409 src/main.rs• L1522-1547
Related guides
The environment system has four related views:
| Guide | Main question |
|---|---|
| Dockerfile catalog | Which release environments are available? |
| Dockerfile generation | How are release environments created or refreshed? |
| Image build and installation | How are images built, published, or used locally? |
| Image configuration | How does the verifier map a release to an exact image digest? |
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the release version in each Dockerfile aligned with its file name, image tag, and digest-map key.
- Update the image digest map after publishing a new or changed image so automatic selection does not use stale content.
- Keep the Rust base-image digest, release build-tool version, platform-tool version, and any integrity data aligned for the same release or release train.
- When a release family changes from Solana to Agave, update both generation rules and the catalog expectations.
- Preserve the project-version metadata and lockfile fallback so programs without a direct
solana-programdependency still select an image. - Treat a Dockerfile change as a publication change; a checked-in catalog entry without a matching published image cannot support automatic verification.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The project has no supported Solana version in workspace metadata or Cargo.lock. | Automatic image selection stops before the build. | Add the CLI version metadata or a supported Solana package version, or provide a compatible custom image. |
| The version is not present in the image digest map. | The verifier cannot select a catalog image. | Publish the matching image and refresh the generated image configuration. |
| A pinned build tool, platform tool, or integrity value is unavailable or invalid. | The image build stops before the toolchain is ready. | Keep the release Dockerfile inputs aligned with the supported release or release train. |
| A catalog Dockerfile is published under the wrong version tag. | The verifier can resolve a digest that does not represent the requested release. | Keep the Dockerfile name, image tag, and digest-map entry based on the same release version. |
| The selected toolchain produces a binary hash different from deployed data. | Verification does not succeed and no match is recorded. | Use the source commit and build arguments for the deployment with its compatible versioned environment. |
Key files
| File | Why to read it |
|---|---|
| src/main.rs | Shows version discovery, image selection, Docker build execution, and binary comparison. |
| src/image_config.rs | Shows the generated release-to-image-digest contract used by automatic selection. |
| generate_dockerfiles.py | Shows how upstream releases become versioned build environments. |
docker/v2.0.22.Dockerfile | Shows a historical Agave environment with a pinned installer. |
docker/v4.2.0.Dockerfile | Shows the Agave 4.2.x build environment and its release-train tool setup. |
docker/v4.3.0.Dockerfile | Shows the Agave 4.3.0 environment and its updated platform-tool train. |
| build-all-images.sh | Shows the simple local path for building every checked-in Dockerfile. |
| .github/…/publish_dockerfile.yaml | Shows single-image publication from a selected versioned Dockerfile. |
| .github/…/publish_all_dockerfiles.yaml | Shows changed-image publication and provenance attestation. |
| update_image_whitelist.py | Shows how published image tags become the digest map consumed by the CLI. |