For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
MAX container
The MAX container is our official Docker container that simplifies the process to deploy a GenAI model with an OpenAI-compatible endpoint. The container includes the latest version of MAX and it integrates with orchestration tools like Kubernetes.
Alternatively, you can also experiment with MAX on a local endpoint using the
max serve command. The result is the same because
the MAX container creates an isolated environment that also uses max serve to
create an endpoint you can interact with using our OpenAI-compatible REST
API.
Get startedβ
First, make sure you're on a system with the following requirements:
Linux
WSL
GPU
Then start an endpoint with the MAX container:
-
Make sure you have Docker installed.
-
Agree to the Gemma 3 license on Hugging Face and set the
HF_TOKENenvironment variable:export HF_TOKEN="hf_..." -
Start the container and an endpoint for Gemma 3:
- NVIDIA
- AMD
docker run --gpus=1 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ -v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \ -p 8000:8000 \ modular/max-nvidia-full:latest \ --model google/gemma-3-27b-itdocker run \ -v ~/.cache/huggingface:/root/.cache/huggingface \ -v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \ --env "HF_TOKEN=${HF_TOKEN}" \ -p 8000:8000 \ --group-add keep-groups \ --device /dev/kfd \ --device /dev/dri \ modular/max-amd:latest \ --model google/gemma-3-27b-itIt can take a few minutes to pull the container and then download and compile the model.
When the endpoint is ready, you'll see a message that says this:
π Server ready on http://0.0.0.0:8000 (Press CTRL+C to quit) -
Open a new terminal and send a request using the
openaiPython API orcurl:- Python
- cURL
-
Create a new virtual environment:
mkdir quickstart && cd quickstartpython3 -m venv .venv/quickstart \ && source .venv/quickstart/bin/activate -
Install the OpenAI Python API:
pip install openai -
Create the following file to send an inference request:
generate-text.pyfrom openai import OpenAI client = OpenAI( base_url="http://0.0.0.0:8000/v1", api_key="EMPTY", ) completion = client.chat.completions.create( model="google/gemma-3-27b-it", messages=[ { "role": "user", "content": "Who won the world series in 2020?" }, ], ) print(completion.choices[0].message.content) -
Run it and you should see results like this:
python generate-text.pyThe **Los Angeles Dodgers** won the World Series in 2020! They defeated the Tampa Bay Rays 4 games to 2. It was their first World Series title since 1988. It was a unique World Series as it was played in a neutral site (Globe Life Field in Arlington, Texas) due to the COVID-19 pandemic.
Run this command:
curl -N http://0.0.0.0:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "google/gemma-3-27b-it", "stream": true, "messages": [ {"role": "user", "content": "Who won the World Series in 2020?"} ] }' | grep -o '"content":"[^"]*"' | sed 's/"content":"//g' | sed 's/"//g' | tr -d '\n' | sed 's/\\n/\n/g'You should see results like this:
The **Los Angeles Dodgers** won the World Series in 2020! They defeated the Tampa Bay Rays 4 games to 2. It was their first World Series title since 1988. It was a unique World Series as it was played in a neutral site (Globe Life Field in Arlington, Texas) due to the COVID-19 pandemic.
For details about the OpenAI-compatible endpoint, see our Serve API docs.
To run a different model, change the --model to something else from our
supported models.
For information about the available containers, see the Modular Docker Hub repositories.
Container optionsβ
The docker run command above includes the bare minimum commands and options,
but there are other docker options you might consider, plus several options
to control features of the endpoint.
Docker optionsβ
-
--gpus: If your system includes a compatible NVIDIA GPU, you must add the--gpusoption in order for the container to access it. It doesn't hurt to include this even if your system doesn't have a GPU compatible with MAX. -
--devices: When deploying MAX on multiple GPUs, you must specify the ID of the GPUs to use. For example, to use four available GPUs, include the following:--devices gpu:0,1,2,3. You can also use--devices gpu:allto use every visible GPU, or--devices cputo run on CPU. If you omit--devices, MAX uses the model or config default. -
-v: We use the-voption to save a cache of Hugging Face and MAX models to your local disk that we can reuse across containers. You can optionally export aMODULAR_MAX_CACHE_DIRenvironment variable to change the MAX cache directory location. -
-p: We use the-poption to specify the exposed port for the endpoint.
You also might need some environment variables (set with --env):
-
HF_TOKEN: This is required to access gated models on Hugging Face (after your account is granted access). For example:docker run \ -v ~/.cache/huggingface:/root/.cache/huggingface \ -v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \ --env "HF_TOKEN=${HF_TOKEN}" \ -p 8000:8000 \ modular/max-nvidia-full:latest \ --model google/gemma-3-27b-itLearn more about
HF_TOKENand how to create Hugging Face access tokens.
MAX optionsβ
Following the container name in the docker run command, you must specify a
model with --model, but there are other options you might need
to configure the max serve behavior.
To see all available options, see the max CLI
page, because the MAX container is basically a
wrapper around that tool.
-
--model: This is required to specify the model you want to deploy. To find other GenAI models that are compatible with MAX, check out our supported models. -
--max-length: Specifies the maximum length of the text sequence (including the input tokens). We mention this one here because it's often necessary to adjust the max length when you have trouble running a large model on a machine with limited memory.
For the rest of the max serve options, see the max CLI
page.
Container contentsβ
There are multiple MAX container options, including:
Full containerβ
The full MAX container (max-full) is a hardware-agnostic container that
deploys the latest version of MAX on both AMD and NVIDIA GPUs.
You can run the container on either NVIDIA or AMD as follows:
- NVIDIA
- AMD
docker run --gpus=1 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \
--env "HF_TOKEN=${HF_TOKEN}" \
-p 8000:8000 \
modular/max-full:latest \
--model google/gemma-3-27b-itdocker run \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \
--env "HF_TOKEN=${HF_TOKEN}" \
--group-add keep-groups \
--device /dev/kfd \
--device /dev/dri \
-p 8000:8000 \
modular/max-full:latest \
--model google/gemma-3-27b-itThe max-full container includes the following:
- Ubuntu 22.04
- Python 3.12
- MAX
- PyTorch (GPU) 2.6.0
- ROCm
- cuDNN
- CUDA 12.8
- NumPy
- Hugging Face Transformers
For more information, see the full MAX container on Docker Hub.
AMD containerβ
The AMD MAX container (max-amd) is great if you want an AMD-specific
deployment without NVIDIA or CUDA dependencies. The AMD MAX container is
available in two flavors:
max-amdincludes all ROCm and PyTorch GPU dependencies.max-amd-baseincludes minimal dependencies, ROCm, and the AMD Driver.
You can run the AMD container as follows:
docker run \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \
--env "HF_TOKEN=${HF_TOKEN}" \
--group-add keep-groups \
--device /dev/kfd \
--device /dev/dri \
-p 8000:8000 \
modular/max-amd:latest \
--model google/gemma-3-27b-itOr, to use the base container, replace max-amd with
max-amd-base.
For more information, see the full AMD container or base AMD container on Docker Hub.
NVIDIA containerβ
The NVIDIA MAX container is available in two flavors:
max-nvidia-fullincludes all CUDA and PyTorch GPU dependencies.max-nvidia-baseincludes minimal dependencies, PyTorch CPU, and the NVIDIA Driver (excludes CUDA).
You can run the NVIDIA container as follows:
docker run --gpus=1 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \
--env "HF_TOKEN=${HF_TOKEN}" \
-p 8000:8000 \
modular/max-nvidia-full:latest \
--model google/gemma-3-27b-itOr, to use the base container, replace max-nvidia-full with
max-nvidia-base.
For more information, see the full NVIDIA container or base NVIDIA container on Docker Hub.
Recommended cloud instancesβ
For best performance and compatibility with our supported models, we recommend that you deploy the MAX container on a cloud instance with a GPU that meets the MAX system requirements.
The Modular Platform is hardware-agnostic and optimized for both the latest NVIDIA and AMD GPUs. To take full advantage of this flexibility, Modular partners with compute providers that prioritize diverse hardware optionality. For enterprise-grade hardware flexibility, see our available editions.
If you're running on AWS, GCP, or Azure and want to test MAX with cloud GPUs, we recommend the following instances:
AWS instances:
GCP instances:
Azure instances:
- ND_GB200_v6-series virtual machine
- NCads_H100_v5-series virtual machine
- NCCads_H100_v5-series virtual machine
- ND_H100_v5-series virtual machine
- NC_A100_v4-series virtual machine
- NDm_A100_v4-series virtual machine
- ND_A100_v4-series virtual machine
- ND_MI300X_v5-series virtual machine (AMD GPU)
Logsβ
The MAX container writes logs to stdout in JSON format, which you can consume and view via your cloud provider's platform (for example, with AWS CloudWatch).
Console log level is INFO by default. You can modify the log level using the
MAX_SERVE_LOGS_CONSOLE_LEVEL environment variable. It accepts the following
log levels (in order of increasing verbosity): CRITICAL, ERROR, WARNING,
INFO, DEBUG. For example:
docker run modular/max-nvidia-full:latest \
-env MAX_SERVE_LOGS_CONSOLE_LEVEL=DEBUG \
...Logs default to structured JSON, but if you'd like a more readable format in
your console, you can disable structured logs by adding the
MODULAR_STRUCTURED_LOGGING=0 environment variable. For example:
docker run --gpus=1 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-v ~/.cache/max_cache:/opt/venv/share/max/.max_cache \
-p 8000:8000 \
--env "MODULAR_STRUCTURED_LOGGING=0" \
modular/max-nvidia-full:latest \
--model google/gemma-3-27b-itMetricsβ
MAX exposes a Prometheus-compatible /metrics endpoint for monitoring
performance. For the full metrics reference and telemetry configuration, see
Serving metrics.
Licenseβ
The NVIDIA MAX container uses the NVIDIA Deep Learning Container license.
Next stepsβ
You can get started with container-based deployments or read more about our supported models.
- Deploy MAX on GPU with self-hosted endpoints: Learn how to deploy MAX pipelines to cloud.
- Benchmark MAX on NVIDIA or AMD GPUs: Learn how to use our benchmarking script to measure the performance of MAX.
- Supported models: See all the model architectures supported by MAX.