Container Images
Applications on Beam are run inside containers. A container is a lightweight VM that packages a set of software packages required by your application.
Containers are based on container images which are instructions for how a container should be built.
Because you are building a custom application, it is likely that your application depends on some custom software to run.
You can customize the container image used to run your Beam application with the Image
parameter.
Beam containers have two defaults to be aware of:
Default Container OS: Ubuntu 20.04
Default CUDA: CUDA 12.3
Using Existing Docker Images
You can import existing images from remote Docker registries, like Docker Hub, Google Artifact Registry, ECR, GitHub Container Registry, Nvidia and more.
Just supply a base_image
argument to Image
.
Beam only supports Debian-based images. In addition, make sure your image is built for the correct x86 architecture.
Adding Shell Commands
You can also run any shell commands you want in the environment before it starts up. Just pass them into the commands
field in your app definition.
Below, we’ll customize our image with requests
and some shell commands:
Adding Python Packages
You can add Python packages to the runtime in the python_packages
field:
python_version
is provided.Alternatively, you can pass in a path to a requirements.txt
file:
Using Anaconda Environments
Beam supports using Anaconda environments via micromamba. To get started, you can chain the micromamba
method to your Image
definition and then specify packages and channels via the add_micromamba_packages
method.
You can still use pip
to install additional packages in the conda
environment and you can run shell commands too.
If you need to run a shell command inside the conda environment, you should prepend the command with micromamba run -n beta9
as shown above.
Using Private Registries
Beam supports importing images from private AWS ECR registries.
You can authenticate with either your static AWS credentials or an AWS STS
token. If you use the AWS STS token, your AWS_SESSION_TOKEN
key must also be
set.
You can either pass the credentials as a dictionary, or export them from your shell and Beam will automatically lookup the values.
Passing Credentials as a Dictionary
You can provide the values for the registry as a dictionary directly, like this:
Passing Credentials from your Environment
Alternatively, you can export your AWS credentials in your shell and pass the environment variable names to base_image_creds
as a list:
Was this page helpful?