Images and the runtime
Choose a starter image or bring your own, and see what Legion adds to every rental.
Every rental runs one container image. Use one of Legion's starter images, or any Linux image of your own, public or private.
Starter images
| Catalog id | Image | CUDA | Driver | PyTorch | Download |
|---|---|---|---|---|---|
pytorch | PyTorch 2.14 (default) | 13. | 580+ | 2. | 3. |
pytorch-jupyter | PyTorch 2.14 + JupyterLab | 13. | 580+ | 2. | 3. |
cuda | CUDA 13.0 | 13. | 580+ | None | 1. |
pytorch-cu128 | PyTorch 2.11 (CUDA 12.8) | 12. | 570+ | 2. | 6. |
cuda-12 | CUDA 12.8 | 12. | 570+ | None | 2. |
On the rent form's Software step, choose Starter image, Model or Your own image under What to run. Every starter image is a tile that says what's inside it, and the one you choose is described in full beside the tiles. One the host can't run is shown greyed out, with the reason, for example a driver that's too old for its CUDA version. The newest image the host can run is chosen for you.
On starter images:
/is the folder a backup copies. Keep your work there. After a rental stops, its files stay on the host for at least 24 hours and at most 72 hours, then are deleted. An interruptible rental set to delete on preemption loses them when preempted. See Stopping, backups and how long your data is kept.workspace Common tools are installed, such as git, rsync, tmux and jq.
pip installgoes into the system Python.
Your own image
Choose Your own image and enter the image reference. The image can be on one of these registries:
docker.io ghcr.io nvcr.io quay.io
Write the whole reference, such as ghcr.. A name with no owner, like cuda, is looked up on Docker Hub as library/.
Legion checks the image before it rents. If the image can't be used, the rent form says why. Through the API, call inspectImage first.
A public image needs nothing more. For a private one, save a registry credential first: see Private images.
Private images
Legion can run a private image from any registry that hands out pull tokens. That covers Docker Hub, GitHub's ghcr., GitLab, Quay, NVIDIA NGC, Harbor, Artifactory, Artifact Registry, Azure Container Registry and self-hosted registries with a token service. Your organization saves a registry credential: a username and a read-only token. Legion runs no registry for it and keeps no copy: the host pulls the image straight from your registry.
When the image you enter is private, the Registry credential section of the rent form says so. If one of your saved credentials fits the image, the section says Uses: acme on ghcr.io and you can press Change to pick another one for this rental. If none fits, press Add a credential:
The form starts with the image you entered (Image to check). Legion reads the registry and the Path prefix from it, and the prefix can be edited. Leave it empty to use the credential for every image on the registry.
Enter a Username and a Token. A Name is optional.
Press Save credential. Legion checks that the credential can read the image before it saves anything.
Press Rent.
You can also add one under Settings, then Registry credentials, which lists them all.
To give a container tokens or other values at run time, use secret environment variables rather than building them into the image.
Use a read-only token made only for Legion, so you can revoke it without touching anything else. What to enter depends on the registry:
| Registry | Username | Token |
|---|---|---|
docker. | Your Docker ID, not your email address | A personal access token with Read-only permission |
ghcr. | Your GitHub username | A classic personal access token with only the read:packages scope. Fine-grained tokens don't work with ghcr. |
nvcr. | $oauthtoken, exactly as written (the form fills it in) | An NGC API key |
quay. | A robot account's name, like acme+legion | The robot account's token, with Read access to the repository |
GitLab (registry.) | The username shown when you create a deploy token | A deploy token with only the read_ scope |
Artifact Registry (*-docker.) | _ | A service account key with the Artifact Registry Reader role, base64 encoded on one line |
Azure (*.) | The token name, or the application ID of a service principal | A repository-scoped token, or a service principal secret with the AcrPull role. Don't use the admin user |
| Harbor and others | A robot account's name, like robot$project+legion | The robot account's secret, with pull permission only |
For any other registry, enter the username and token its administrator gave you.
Several credentials, matched automatically
An organization can save up to 20 credentials, and several for one registry host. Each has a path prefix: the part of the image path it covers. A credential for ghcr. with the prefix acme is used for ghcr., and another for ghcr. with the prefix other-org is used for that organization's images. An empty prefix covers every image on the host.
When you rent, Legion uses the credential whose host matches the image and whose prefix is the longest match. The rent form shows it as Uses: acme on ghcr.io, with the name you gave it, or the host and prefix when it has none. Change picks a different credential on the same host for this rental. A rental keeps the credential it started with.
Saving never replaces another credential. A second credential with the same host and prefix is refused, and the answer names the one that exists: replace its token instead.
Who can do what
Any member can rent with a saved credential. Adding one, replacing its token, renaming it and removing it need the registry. permission, which owners have. Everyone in the organization can see the list (name, host, prefix, username, who saved it, when it was last used), never a token.
Removing a credential is refused while a rental that may still pull with it exists. The answer names those rentals: stop or delete them, then remove it. Rentals already running keep running, and a rental that has to pull its image again needs its credential until it ends.
If the registry later refuses the credential, for example because the token was revoked, the rent form says so and offers to save a new token. A rental whose pull is refused fails with the reason. An organization can save 20 times an hour, including saves that fail.
What happens to the token
Legion keeps it encrypted and never shows it again, to anyone.
It's never sent to a host. When a host pulls your image, Legion exchanges the credential at the registry's own token service for a pull token for that one repository. The registry issues it and decides how long it lasts, and it is short-lived. It can read every tag in that repository, not only the image you rented.
The registry's token service is found when you save and pinned: the token is only ever sent there.
The image runs on the provider's machine, where the provider has full access. Treat what's in the image as visible to that provider, and don't build secrets into it.
Not supported yet
AWS ECR (
*.). An ECR password is a 12-hour token made from AWS keys. A host could only pull with a long-lived secret, which Legion never sends to a host. Push the image to a registry in the table above, or mirror it to one. Images ondkr. ecr. *. amazonaws. com public.are public and need no credential.ecr. aws Registries that only accept a username and password and have no token service, for the same reason.
Registries on an IP address, a port other than 443, or a name with a single label, and any address inside Legion's own network.
Through the API: createRegistryCredential, listRegistryCredentials, updateRegistryCredential, deleteRegistryCredential and detectRegistryCredential, which splits an image reference into host and prefix without saving anything. createRental takes an optional registry_ to use a credential other than the matched one. The older putRegistrySignIn operations still work for a credential that covers a whole host and are deprecated. From a terminal, see legion registry.
What Legion adds
Any Linux image works. Legion adds its own SSH server and init process to your container, so SSH and the web terminal work whatever image you choose. Your image's ENTRYPOINT, CMD, USER and environment are kept.
If your image starts its own init system, such as systemd or s6, it runs beneath Legion's init.
When your process exits
If your image's own process exits, the rental stays up and SSH keeps working. The login message shows its exit status. Its last output is in /.
Shared memory
/ is half the rental's memory, between 1 GiB and 64 GiB.