Skip to main content
Are you a large language model? This page is available as raw markdown at /environments.md. The full docset is at /llms-full.md and the index is at /llms.md.

Environments

By default, C3 runs your script inside a container delivered through Nydus, with a persistent JuiceFS workspace. Choose how to prepare that container:

Your projectUseC3 prepares
Python with a pyproject.tomlpython:A reusable container with Python and your locked dependencies already installed
Anything with system packages, other languages, custom CUDAdocker:A public Docker Hub or GitHub Container Registry image, your script runs inside it
Self-contained binaries or Bash scriptsdocker:A suitable base image such as ubuntu:24.04

python: and docker: cannot be combined. Setup done inside the script itself runs again on every job.

Python​

project: python-example
script: run.sh
hardware: l40
time: "02:00:00"

python:
project: ./

output:
- ./results
# run.sh
#!/bin/bash
set -euo pipefail
python3 train.py --output "$C3_ARTIFACTS_DIR"
# pyproject.toml
[project]
name = "python-example"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["jax[cuda12]", "numpy"]

Before allocating a GPU, C3 prepares your Python interpreter and locked dependencies on a CPU worker, then runs your script inside the resulting container. The base includes Python 3.12; preparation can download the interpreter your project requests. The virtualenv and interpreter live in the container, outside your persistent workspace.

Unchanged environments are reused across jobs and fresh VMs. Changing the interpreter, dependency configuration, lockfile or local dependency source prepares a new environment. Code and result changes do not rebuild ordinary static dependency environments. Your submitted project runs from the workspace; as before, C3 does not install the root project as a package. Local dependency packages are built into the environment. Prepared environments remain private to your organization. Packages requiring additional system libraries should use a custom docker.image. Managed Python requires a provider image qualified for this mode. Create or refresh the lock file locally:

uv lock

If you only have a requirements.txt, create a pyproject.toml with uv init and uv add -r requirements.txt, then uv lock. If the project is in a subdirectory, point python.project at it.

Docker​

project: docker-example
script: run.sh
hardware: l40
time: "02:00:00"

docker:
image: pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime
requires_accelerator: cuda

output:
- ./results

C3 prepares the image once per immutable image/platform and reuses its Nydus representation. It runs bash /workspace/run.sh with your persistent workspace, attached data resources and $C3_ARTIFACTS_DIR mounted. Select --environment-delivery=oci to use ordinary container delivery instead.

Images on the GitHub Container Registry work the same way:

docker:
image: ghcr.io/my-lab/trainer:1.4
requires_accelerator: cuda

Requirements:

  • Without a registered credential reference, use a public image on Docker Hub or ghcr.io. ubuntu:24.04, user/image:tag, docker.io/... and ghcr.io/<owner>/<image>:<tag> are accepted, with a tag or a digest. Other registries are rejected before upload. Anonymous pulls require a public package; GHCR reports private or missing packages as denied.
  • C3 reuses an image already present on the machine. Pin a digest if you need a specific build rather than a mutable tag such as latest.
  • The image must contain bash. Alpine and distroless images often do not.
  • Set requires_accelerator: cuda for GPU images and none for CPU images. C3 stops before running the script if the machine does not match.
  • C3 preserves the verified image environment for the payload, while fixing workspace, home and cache destinations for isolation.

If C3 has registered a private registry credential for your organization, pass its reference alongside the image:

docker:
image: registry.example.com/team/trainer:1.4
credential_id: my-registered-reference

credential_id is a nonsecret reference, not a password or token. The server checks its organization, registry and repository before preparing the image. A refusal fails the submission; C3 never retries it anonymously. This requires JuiceFS storage and works with Nydus or ordinary OCI delivery. It cannot be used with python:, legacy storage or c3 ar deploy. MCP deploy accepts the same reference as docker_credential_id. Public images need no new setting.

For a CPU offering without the persistent runtime, use --storage=legacy and set requires_accelerator: none. See CPU jobs.

Bash​

project: bash-example
script: run.sh
hardware: l40
time: "00:30:00"

docker:
image: ubuntu:24.04

output:
- ./results
# run.sh
#!/bin/bash
set -euo pipefail
mkdir -p results
./bin/my-simulation --output results/output.dat

Whatever the script installs is installed again on every job. Move that setup into python: or docker: when startup time matters.

Container contents and persistence​

The container supplies Python, system libraries and command-line tools. The managed Python image supplies Bash and uv; projects needing a compiler or extra system packages should use a custom Docker image. GPU jobs receive the assigned GPU devices and driver libraries through the isolated runtime.

Files under /workspace and attached writable data resources persist between jobs. Changes to the container root, /tmp or the job home are temporary. Prepared Python environments can be reused without receiving the same VM.

--storage=legacy explicitly selects the older execution/storage pathway for compatible offerings. It is never selected automatically after a runtime failure.

Variables available to your script​

VariableValue
Working directory/workspace
C3_ARTIFACTS_DIR/artifacts
HOME/home/job (temporary)
VIRTUAL_ENV/opt/c3/python/venv in managed Python mode
TMPDIR/tmp (temporary)

The environment is sanitised: no C3 credentials or storage keys are visible to your script. .env files in your workspace are uploaded but not loaded; load them yourself if you need them.