Skip to content

Container images

How to build the project's images from its Dockerfiles, push them to an Amazon ECR repository in your own AWS account, and pull them back. Use this to run the benchmark from your own registry, or to rebuild an image with other pinned commits.

Image Dockerfile Build context Runs on
trn2 vLLM server deploy/trn2/Dockerfile deploy/trn2/ trn2 hosts (needs Neuron devices)
Benchmark client deploy/client/Dockerfile Repository root Any x86-64 host with Docker

The NVIDIA hosts run the upstream vllm/vllm-openai image, which has no Dockerfile here. To keep a copy in your own registry, see Mirror the NVIDIA image.

Before you start

You need:

  • Docker, with BuildKit (the default in current Docker).
  • AWS CLI v2, signed in to the account that will own the repositories.
  • IAM permissions to create ECR repositories and push to them: ecr:CreateRepository, ecr:GetAuthorizationToken, ecr:BatchCheckLayerAvailability, ecr:InitiateLayerUpload, ecr:UploadLayerPart, ecr:CompleteLayerUpload and ecr:PutImage.
  • About 30 GB of free disk. The trn2 image is about 8 GB, and its base image has to be downloaded first.

Both images are built for x86-64 (linux/amd64), the architecture of every host in this project. On an Apple Silicon Mac or another Arm machine, keep --platform linux/amd64 in the build commands below. Docker then emulates x86-64, which works but is slow for the trn2 image. Building on an x86-64 EC2 instance in the same region as the repository is much faster.

Set these once per shell. Use the region your hosts will pull from, so pulls stay in-region:

export AWS_REGION=<region>; export ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"; export REGISTRY="$ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com"

1. Create the repositories

Once per account and region:

aws ecr create-repository --region "$AWS_REGION" --repository-name snap-vllm-neuron --image-tag-mutability IMMUTABLE --image-scanning-configuration scanOnPush=true
aws ecr create-repository --region "$AWS_REGION" --repository-name snap-asr-bench-client --image-tag-mutability IMMUTABLE --image-scanning-configuration scanOnPush=true

IMMUTABLE stops a tag being pushed twice, so a tag always means the same image. Any repository names work, but the project's IAM policy (ecr-trn2-image in terraform/iam.tf) only grants access to snap-vllm-neuron. If you pick another name, update the policy as well.

2. Log in to ECR

aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REGISTRY"

The login lasts 12 hours. Run it again if a push or pull fails with no basic auth credentials or authorization token has expired.

3. Build and push the trn2 image

With make

make image-push-trn2 REGISTRY="$REGISTRY" runs steps 2 and 3: it logs in, builds with the commits pinned in the Dockerfile and pushes. It names the tag the same way as below. make image-trn2 only builds. Override the commits with VLLM_NEURON_SHA= and NKI_LIBRARY_SHA=.

The Dockerfile starts from AWS's public Neuron SDK 2.33 vLLM image (pinned by digest) and clones the jimburtoft fork and its nki-library at pinned commits. It also adds soundfile and av, without which every transcription fails. Building it doesn't need Neuron hardware, only network access to public.ecr.aws, GitHub and PyPI.

Tag the image with the two commits it contains, as the project does. The defaults in the Dockerfile are 8533ceb and 90dc412:

export TRN2_IMAGE="$REGISTRY/snap-vllm-neuron:trn2-8533ceb-90dc412-audio"

From the repository root:

docker build --platform linux/amd64 -t "$TRN2_IMAGE" deploy/trn2
docker push "$TRN2_IMAGE"

To build other commits, pass them as build arguments, and change the tag to match:

docker build --platform linux/amd64 --build-arg VLLM_NEURON_SHA=<full sha> --build-arg NKI_LIBRARY_SHA=<full sha> -t "$REGISTRY/snap-vllm-neuron:trn2-<fork short sha>-<nki short sha>-audio" deploy/trn2

The branches the commits come from are also build arguments (VLLM_NEURON_REF and NKI_LIBRARY_REF). Keep the -audio suffix: the project uses it to mark images that include soundfile and av.

4. Build and push the client image

With make

make image-push-client REGISTRY="$REGISTRY" logs in, builds and pushes, tagged with git describe --always --dirty. It refuses to push if tracked files have uncommitted changes, so the tag always names the code in the image. make image-client only builds.

The client Dockerfile copies pyproject.toml, uv.lock, .python-version, README.md and src/, so the build context is the repository root. The Python and uv base images are pinned by digest, and dependencies come from uv.lock. Tag it with the Git commit it was built from:

export CLIENT_IMAGE="$REGISTRY/snap-asr-bench-client:$(git rev-parse --short HEAD)"
docker build --platform linux/amd64 -f deploy/client/Dockerfile -t "$CLIENT_IMAGE" .
docker push "$CLIENT_IMAGE"

Debian's ffmpeg is installed at build time and isn't pinned, so two builds from the same commit can contain different ffmpeg versions. Each run logs the version in run_start (host.tools).

5. Pull the images

On any machine logged in to the registry (step 2):

docker pull "$TRN2_IMAGE"
docker pull "$CLIENT_IMAGE"

Check what you got. The digest identifies the exact image, and is what the project's start scripts log:

docker image inspect --format '{{.Id}} {{.RepoDigests}}' "$TRN2_IMAGE"

The client image runs anywhere Docker does:

docker run --rm "$CLIENT_IMAGE" --help

The trn2 image only serves on a host with Neuron devices. Elsewhere you can pull and inspect it, but vllm serve won't start.

Use your images in the deployment

trn2 server. Set IMAGE in deploy/trn2/trn2.local.env to your $TRN2_IMAGE (Trainium host), then reinstall with make install-vllm-trn2 or the Trainium host steps. make install-vllm-trn2 reads the registry and region from IMAGE, logs in and pulls. The host's instance role needs ecr:GetAuthorizationToken, ecr:BatchCheckLayerAvailability, ecr:GetDownloadUrlForLayer and ecr:BatchGetImage on your repository.

If the repository is in a different account from the hosts, the repository also needs a policy that allows those pull actions for the hosts' account or instance role:

aws ecr set-repository-policy --region "$AWS_REGION" --repository-name snap-vllm-neuron --policy-text '{"Version":"2012-10-17","Statement":[{"Sid":"PullFromHostAccount","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::<host account id>:root"},"Action":["ecr:BatchCheckLayerAvailability","ecr:GetDownloadUrlForLayer","ecr:BatchGetImage"]}]}'

Client. On-host runs don't pull the client image. deploy/client/run-local.sh builds it on each host from the synced code, so the image always matches that code. A pushed client image is useful for running the client somewhere else, or for checking that every host ran the same build. Using it for on-host runs would mean changing run-local.sh to pull instead of build.

Mirror the NVIDIA image

The NVIDIA hosts pull vllm/vllm-openai:v0.33.0 from Docker Hub. To serve it from your own ECR instead, create a vllm-openai repository as in step 1, then copy the image:

docker pull --platform linux/amd64 vllm/vllm-openai:v0.33.0 && docker tag vllm/vllm-openai:v0.33.0 "$REGISTRY/vllm-openai:v0.33.0" && docker push "$REGISTRY/vllm-openai:v0.33.0"

Then set IMAGE to the new name in deploy/nvidia/g4dn.local.env, g7e.local.env and g6.local.env, which override the shipped env files (NVIDIA hosts). make install-vllm-nvidia pulls with plain docker pull and doesn't log in to ECR, so run step 2 on the host first, and give the instance role the pull permissions listed above.