Explore / Programming The vLLM Dockerfile is used to construct vLLM image that can be directly used to run the… Save Share Download ▾ ReportThe vLLM Dockerfile is used to construct vLLM image that can be directly used
to run the OpenAI compatible server.
Please update any changes made here to
docs/contributing/dockerfile/dockerfile.md and
docs/assets/contributing/dockerfile-stages-dependency.png
ARG CUDA_VERSION=12.8.1
ARG PYTHON_VERSION=3.12
By parameterizing the base images, we allow third-party to use their own
base images. One use case is hermetic builds with base images stored in
private registries that use a different repository naming conventions.
Example:
docker build --build-arg BUILD_BASE_IMAGE=registry.acme.org/mirror/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
ARG BUILD_BASE_IMAGE=nvidia/cuda:C U D A V E R S I O N − d e v e l − u b u n t u 20.04 A R G F I N A L B A S E I M A G E = n v i d i a / c u d a : {CUDA_VERSION}-devel-ubuntu20.04
ARG FINAL_BASE_IMAGE=nvidia/cuda: C U D A {CUDA_VERSION}-devel-ubuntu22.04
Show full message · 532 lines Assistant2025-07-11 15:44 UTC Copy response
Copy first prompt
Details
Provider OpenAI
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Conversation date Jul 11, 2025
Added to archive Nov 16, 2026
ID 01m7h42x6jr41qkfmw8r7jr04pSource & license Imported from WildChat-4.8M (AI2) (source ). Imported records earn no Research Points.
Upstream record: ea2cb72895cc4b80b44dabc4f2f53eba
Zhao et al., WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024). Contains information from WildChat-4.8M, made available under the ODC Attribution License.
License: ODC-BY-1.0
V
E
R
S
I
O
N
−
d e v e l −
u b u n t u 20.04 A R GF I N A L B A S E I M A GE =
n v i d ia / c u d a :
By parameterizing the Deadsnakes repository URL, we allow third-party to use
their own mirror. When doing so, we don't benefit from the transparent
installation of the GPG key of the PPA, as done by add-apt-repository, so we
also need a URL for the GPG key. ARG DEADSNAKES_MIRROR_URL
ARG DEADSNAKES_GPGKEY_URL
The PyPA get-pip.py script is a self contained script+zip file, that provides
both the installer script and the pip base85-encoded zip archive. This allows
bootstrapping pip in environment where a dsitribution package does not exist.
By parameterizing the URL for get-pip.py installation script, we allow
third-party to use their own copy of the script stored in a private mirror.
We set the default value to the PyPA owned get-pip.py script.
PIP supports fetching the packages from custom indexes, allowing third-party
to host the packages in private mirrors. The PIP_INDEX_URL and
PIP_EXTRA_INDEX_URL are standard PIP environment variables to override the
default indexes. By letting them empty by default, PIP will use its default
indexes if the build process doesn't override the indexes.
Uv uses different variables. We set them by default to the same values as
PIP, but they can be overridden. ARG PIP_INDEX_URL
ARG PIP_EXTRA_INDEX_URL
ARG UV_INDEX_URL=P I P I N D E X U R L A R G U V E X T R A I N D E X U R L = {PIP_INDEX_URL}
ARG UV_EXTRA_INDEX_URL= P I P I N D E X U R L A R G U V E X T R A I N D E X U R L = {PIP_EXTRA_INDEX_URL}
PyTorch provides its own indexes for standard and nightly builds
PIP supports multiple authentication schemes, including keyring
By parameterizing the PIP_KEYRING_PROVIDER variable and setting it to
disabled by default, we allow third-party to use keyring authentication for
their private Python indexes, while not changing the default behavior which
is no authentication.
ARG PIP_KEYRING_PROVIDER=disabled
ARG UV_KEYRING_PROVIDER=${PIP_KEYRING_PROVIDER}
Flag enables build-in KV-connector dependency libs into docker images ARG INSTALL_KV_CONNECTORS=false
#################### BASE BUILD IMAGE ####################
prepare basic build environment FROM ${BUILD_BASE_IMAGE} AS base
ARG CUDA_VERSION
ARG PYTHON_VERSION
ARG TARGETPLATFORM
ARG INSTALL_KV_CONNECTORS=false
ENV DEBIAN_FRONTEND=noninteractive
ARG DEADSNAKES_MIRROR_URL
ARG DEADSNAKES_GPGKEY_URL
ARG GET_PIP_URL
Install Python and other dependencies RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections
&& apt-get update -y
&& apt-get install -y ccache software-properties-common git curl sudo
&& if [ ! -z D E A D S N A K E S M I R R O R U R L ] ; t h e n i f [ ! − z " {DEADSNAKES_MIRROR_URL} ] ; then \
if [ ! -z " D E A D S N A K E S M I R R O R U R L ] ; t h e n i f [ ! − z " {DEADSNAKES_GPGKEY_URL}" ] ; then
mkdir -p -m 0755 /etc/apt/keyrings ;
curl -L D E A D S N A K E S G P G K E Y U R L ∣ g p g − − d e a r m o r > / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ; s u d o c h m o d 644 / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ; e c h o " d e b [ s i g n {DEADSNAKES_MIRROR_URL} (lsb_release -cs) main" > /etc/apt/sources.list.d/deadsnakes.list ; \
fi ; \
else \
for i in 1 2 3; do \
add-apt-repository -y ppa:deadsnakes/ppa && break || \
{ echo "Attempt i failed, retrying in 5s..."; sleep 5; };
done ;
fi
&& apt-get update -y
&& apt-get install -y pythonP Y T H O N V E R S I O N p y t h o n {PYTHON_VERSION} python P Y T H O N V E R S I O N p y t h o n {PYTHON_VERSION}-dev python{PYTHON_VERSION}-venv \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python {PYTHON_VERSION} 1
&& update-alternatives --set python3 /usr/bin/python{PYTHON_VERSION} \
&& ln -sf /usr/bin/python {PYTHON_VERSION}-config /usr/bin/python3-config
&& curl -sS G E T P I P U R L ∣ p y t h o n {GET_PIP_URL} | python GE T P I P U R L ∣ p y t h o n {PYTHON_VERSION}
&& python3 --version && python3 -m pip --version
ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
ARG PYTORCH_CUDA_INDEX_BASE_URL
ARG PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL
ARG PIP_KEYRING_PROVIDER UV_KEYRING_PROVIDER
Install uv for faster pip installs RUN --mount=type=cache,target=/root/.cache/uv
python3 -m pip install uv
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
as it was causing spam when compiling the CUTLASS kernels RUN apt-get install -y gcc-10 g++-10
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 110 --slave /usr/bin/g++ g++ /usr/bin/g++-10
RUN <<EOF
gcc --version
EOF
this won't be needed for future versions of this docker image
or future versions of triton. RUN ldconfig /usr/local/cuda-( e c h o (echo ( ec h o CUDA_VERSION | cut -d. -f1,2)/compat/
install build and runtime dependencies
arm64 (GH200) build follows the practice of "use existing pytorch" build,
we need to install torch and torchvision from the nightly builds first,
pytorch will not appear as a vLLM dependency in all of the following steps
after this step RUN --mount=type=cache,target=/root/.cache/uv
if [ "T A R G E T P L A T F O R M " = " l i n u x / a r m 64 " ] ; t h e n u v p i p i n s t a l l − − s y s t e m − − i n d e x − u r l TARGETPLATFORM" = "linux/arm64" ]; then \
uv pip install --system \
--index-url T A R GE T P L A T F O R M " = " l in ux / a r m 64" ] ; t h e n uv p i p in s t a l l − − sy s t e m − − in d e x − u r l {PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL}/cu( e c h o (echo ( ec h o CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
"torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319";
uv pip install --system
--index-url P Y T O R C H C U D A N I G H T L Y I N D E X B A S E U R L / c u {PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL}/cu P Y T O R C H C U D A N (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
--pre pytorch_triton==3.3.0+gitab727c40;
fi
COPY requirements/common.txt requirements/common.txt
COPY requirements/cuda.txt requirements/cuda.txt
RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system -r requirements/cuda.txt
--extra-index-url P Y T O R C H C U D A I N D E X B A S E U R L / c u {PYTORCH_CUDA_INDEX_BASE_URL}/cu P Y T O R C H C U D A I N D E X B A S E U R L / c u (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
cuda arch list used by torch
can be useful for both dev and test
explicitly set the list to avoid issues with torch 2.2 ARG torch_cuda_arch_list='7.0 7.5 8.0 8.9 9.0 10.0 12.0'
ENV TORCH_CUDA_ARCH_LIST=${torch_cuda_arch_list}
Override the arch list for flash-attn to reduce the binary size ARG vllm_fa_cmake_gpu_arches='80-real;90-real'
ENV VLLM_FA_CMAKE_GPU_ARCHES=${vllm_fa_cmake_gpu_arches}
#################### BASE BUILD IMAGE ####################
#################### WHEEL BUILD IMAGE ####################
FROM base AS build
ARG TARGETPLATFORM
ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
ARG PYTORCH_CUDA_INDEX_BASE_URL
install build dependencies COPY requirements/build.txt requirements/build.txt
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system -r requirements/build.txt
--extra-index-url P Y T O R C H C U D A I N D E X B A S E U R L / c u {PYTORCH_CUDA_INDEX_BASE_URL}/cu P Y T O R C H C U D A I N D E X B A S E U R L / c u (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
COPY . .
ARG GIT_REPO_CHECK=0
RUN --mount=type=bind,source=.git,target=.git
if [ "$GIT_REPO_CHECK" != "0" ]; then bash tools/check_repo.sh ; fi
max jobs used by Ninja to build extensions ARG max_jobs=2
ENV MAX_JOBS=${max_jobs}
number of threads used by nvcc ARG nvcc_threads=8
ENV NVCC_THREADS=$nvcc_threads
if USE_SCCACHE is set, use sccache to speed up compilation RUN --mount=type=cache,target=/root/.cache/uv
--mount=type=bind,source=.git,target=.git
if [ "USE_SCCACHE" = "1" ]; then \
echo "Installing sccache..." \
&& curl -L -o sccache.tar.gz {SCCACHE_DOWNLOAD_URL}
&& tar -xzf sccache.tar.gz
&& sudo mv sccache-v0.8.1-x86_64-unknown-linux-musl/sccache /usr/bin/sccache
&& rm -rf sccache.tar.gz sccache-v0.8.1-x86_64-unknown-linux-musl
&& if [ ! -z S C C A C H E E N D P O I N T ] ; t h e n e x p o r t S C C A C H E E N D P O I N T = {SCCACHE_ENDPOINT} ] ; then export SCCACHE_ENDPOINT= S C C A C H E E N D P O I N T ] ; t h e n e x p or tS C C A C H E E N D P O I N T = {SCCACHE_ENDPOINT} ; fi
&& export SCCACHE_BUCKET={SCCACHE_BUCKET_NAME} \
&& export SCCACHE_REGION= {SCCACHE_REGION_NAME}
&& export SCCACHE_S3_NO_CREDENTIALS=${SCCACHE_S3_NO_CREDENTIALS}
&& export SCCACHE_IDLE_TIMEOUT=0
&& export CMAKE_BUILD_TYPE=Release
&& sccache --show-stats
&& python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38
&& sccache --show-stats;
fi
ENV CCACHE_DIR=/root/.cache/ccache
RUN --mount=type=cache,target=/root/.cache/ccache
--mount=type=cache,target=/root/.cache/uv
--mount=type=bind,source=.git,target=.git
if [ "$USE_SCCACHE" != "1" ]; then
# Clean any existing CMake artifacts
rm -rf .deps &&
mkdir -p .deps &&
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38;
fi
Check the size of the wheel if RUN_WHEEL_CHECK is true COPY .buildkite/check-wheel-size.py check-wheel-size.py
sync the default value with .buildkite/check-wheel-size.py ARG VLLM_MAX_SIZE_MB=400
ENV VLLM_MAX_SIZE_MB=V L L M M A X S I Z E M B A R G R U N W H E E L C H E C K = t r u e R U N i f [ " VLLM_MAX_SIZE_MB
ARG RUN_WHEEL_CHECK=true
RUN if [ " V LL M M A X S I Z E M B A R GR U N W H E E L C H E C K = t r u e R U N i f [ " RUN_WHEEL_CHECK" = "true" ]; then
python3 check-wheel-size.py dist;
else
echo "Skipping wheel size check.";
fi
#################### EXTENSION Build IMAGE ####################
#################### DEV IMAGE ####################
FROM base as dev
ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
ARG PYTORCH_CUDA_INDEX_BASE_URL
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
Workaround for #17068 COPY requirements/lint.txt requirements/lint.txt
COPY requirements/test.txt requirements/test.txt
COPY requirements/dev.txt requirements/dev.txt
RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system -r requirements/dev.txt
--extra-index-url P Y T O R C H C U D A I N D E X B A S E U R L / c u {PYTORCH_CUDA_INDEX_BASE_URL}/cu P Y T O R C H C U D A I N D E X B A S E U R L / c u (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
#################### DEV IMAGE ####################
#################### vLLM installation IMAGE ####################
image with vLLM installed
TODO: Restore to base image after FlashInfer AOT wheel fixed FROM ${FINAL_BASE_IMAGE} AS vllm-base
ARG CUDA_VERSION
ARG PYTHON_VERSION
ARG INSTALL_KV_CONNECTORS=false
WORKDIR /vllm-workspace
ENV DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
SHELL ["/bin/bash", "-c"]
ARG DEADSNAKES_MIRROR_URL
ARG DEADSNAKES_GPGKEY_URL
ARG GET_PIP_URL
RUN PYTHON_VERSION_STR=( e c h o (echo ( ec h o {PYTHON_VERSION} | sed 's/.//g') &&
echo "export PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> /etc/environment
Install Python and other dependencies RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections
&& apt-get update -y
&& apt-get install -y ccache software-properties-common git curl wget sudo vim python3-pip
&& apt-get install -y ffmpeg libsm6 libxext6 libgl1
&& if [ ! -z D E A D S N A K E S M I R R O R U R L ] ; t h e n i f [ ! − z " {DEADSNAKES_MIRROR_URL} ] ; then \
if [ ! -z " D E A D S N A K E S M I R R O R U R L ] ; t h e n i f [ ! − z " {DEADSNAKES_GPGKEY_URL}" ] ; then
mkdir -p -m 0755 /etc/apt/keyrings ;
curl -L D E A D S N A K E S G P G K E Y U R L ∣ g p g − − d e a r m o r > / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ; s u d o c h m o d 644 / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ; e c h o " d e b [ s i g n {DEADSNAKES_MIRROR_URL} (lsb_release -cs) main" > /etc/apt/sources.list.d/deadsnakes.list ; \
fi ; \
else \
for i in 1 2 3; do \
add-apt-repository -y ppa:deadsnakes/ppa && break || \
{ echo "Attempt i failed, retrying in 5s..."; sleep 5; };
done ;
fi
&& apt-get update -y
&& apt-get install -y pythonP Y T H O N V E R S I O N p y t h o n {PYTHON_VERSION} python P Y T H O N V E R S I O N p y t h o n {PYTHON_VERSION}-dev python{PYTHON_VERSION}-venv libibverbs-dev \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python {PYTHON_VERSION} 1
&& update-alternatives --set python3 /usr/bin/python{PYTHON_VERSION} \
&& ln -sf /usr/bin/python {PYTHON_VERSION}-config /usr/bin/python3-config
&& curl -sS G E T P I P U R L ∣ p y t h o n {GET_PIP_URL} | python GE T P I P U R L ∣ p y t h o n {PYTHON_VERSION}
&& python3 --version && python3 -m pip --version
ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
ARG PYTORCH_CUDA_INDEX_BASE_URL
ARG PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL
ARG PIP_KEYRING_PROVIDER UV_KEYRING_PROVIDER
Install uv for faster pip installs RUN --mount=type=cache,target=/root/.cache/uv
python3 -m pip install uv
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
this won't be needed for future versions of this docker image
or future versions of triton. RUN ldconfig /usr/local/cuda-( e c h o (echo ( ec h o CUDA_VERSION | cut -d. -f1,2)/compat/
arm64 (GH200) build follows the practice of "use existing pytorch" build,
we need to install torch and torchvision from the nightly builds first,
pytorch will not appear as a vLLM dependency in all of the following steps
after this step RUN --mount=type=cache,target=/root/.cache/uv
if [ "T A R G E T P L A T F O R M " = " l i n u x / a r m 64 " ] ; t h e n u v p i p i n s t a l l − − s y s t e m − − i n d e x − u r l TARGETPLATFORM" = "linux/arm64" ]; then \
uv pip install --system \
--index-url T A R GE T P L A T F O R M " = " l in ux / a r m 64" ] ; t h e n uv p i p in s t a l l − − sy s t e m − − in d e x − u r l {PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL}/cu( e c h o (echo ( ec h o CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
"torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319" ;
uv pip install --system
--index-url P Y T O R C H C U D A N I G H T L Y I N D E X B A S E U R L / c u {PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL}/cu P Y T O R C H C U D A N (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
--pre pytorch_triton==3.3.0+gitab727c40 ;
fi
Install vllm wheel first, so that torch etc will be installed. RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist
--mount=type=cache,target=/root/.cache/uv
uv pip install --system dist/*.whl --verbose
--extra-index-url P Y T O R C H C U D A I N D E X B A S E U R L / c u {PYTORCH_CUDA_INDEX_BASE_URL}/cu P Y T O R C H C U D A I N D E X B A S E U R L / c u (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
If we need to build FlashInfer wheel before its release:
$ # Note we remove 7.0 from the arch list compared to the list below, since FlashInfer only supports sm75+
$ export TORCH_CUDA_ARCH_LIST='7.5 8.0 8.9 9.0a 10.0a 12.0'
$ cd flashinfer
$ git checkout v0.2.6.post1
$ python -m flashinfer.aot
$ python -m build --no-isolation --wheel
$ ls -la dist
-rw-rw-r-- 1 mgoin mgoin 205M Jun 9 18:03 flashinfer_python-0.2.6.post1-cp39-abi3-linux_x86_64.whl
Allow specifying a version, Git revision or local .whl file
Flag to control whether to use pre-built FlashInfer wheels (set to false to force build from source)
TODO: Currently disabled because the pre-built wheels are not available for FLASHINFER_GIT_REF ARG USE_FLASHINFER_PREBUILT_WHEEL=false
RUN --mount=type=cache,target=/root/.cache/uv bash - <<'BASH'
. /etc/environment
if [ "TARGETPLATFORM" != "linux/arm64" ]; then
# FlashInfer already has a wheel for PyTorch 2.7.0 and CUDA 12.8. This is enough for CI use
if [[ " CUDA_VERSION" == 12.8* ]] && [[ "U S E F L A S H I N F E R P R E B U I L T W H E E L " = = " t r u e " ] ] ; t h e n u v p i p i n s t a l l − − s y s t e m USE_FLASHINFER_PREBUILT_WHEEL" == "true" ]]; then
uv pip install --system U S E F L A S H I N F E R P R E B U I L T W H E E L " == " t r u e " ]] ; t h e n uv p i p in s t a l l − − sy s t e m {FLASHINFER_CUDA128_INDEX_URL}/{FLASHINFER_CUDA128_WHEEL}
else
# Exclude CUDA arches for older versions (11.x and 12.0-12.7)
# TODO: Update this to allow setting TORCH_CUDA_ARCH_LIST as a build arg.
if [[ " {CUDA_VERSION}" == 11.* ]]; then
FI_TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9"
elif [[ "{CUDA_VERSION}" == 12.[0-7]* ]]; then
FI_TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9 9.0a"
else
# CUDA 12.8+ supports 10.0a and 12.0
FI_TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9 9.0a 10.0a 12.0"
fi
echo "🏗️ Building FlashInfer for arches: {FI_TORCH_CUDA_ARCH_LIST}"
code Copy code
git clone --depth 1 --recursive --shallow-submodules \
--branch ${FLASHINFER_GIT_REF} \
${FLASHINFER_GIT_REPO} flashinfer
# Needed to build AOT kernels
pushd flashinfer
TORCH_CUDA_ARCH_LIST="${FI_TORCH_CUDA_ARCH_LIST}" \
python3 -m flashinfer.aot
TORCH_CUDA_ARCH_LIST="${FI_TORCH_CUDA_ARCH_LIST}" \
uv pip install --system --no-build-isolation .
popd
rm -rf flashinfer
fi \
fi
BASH
COPY examples examples
COPY benchmarks benchmarks
COPY ./vllm/collect_env.py .
RUN --mount=type=cache,target=/root/.cache/uv
. /etc/environment &&
uv pip list
Even when we build Flashinfer with AOT mode, there's still
some issues w.r.t. JIT compilation. Therefore we need to
install build dependencies for JIT compilation.
TODO: Remove this once FlashInfer AOT wheel is fixed COPY requirements/build.txt requirements/build.txt
RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system -r requirements/build.txt
--extra-index-url P Y T O R C H C U D A I N D E X B A S E U R L / c u {PYTORCH_CUDA_INDEX_BASE_URL}/cu P Y T O R C H C U D A I N D E X B A S E U R L / c u (echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
#################### vLLM installation IMAGE ####################
#################### TEST IMAGE ####################
image to run unit testing suite
note that this uses vllm installed by pip ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
Workaround for #17068
install development dependencies (for testing) RUN --mount=type=cache,target=/root/.cache/uv
CUDA_MAJOR="{CUDA_VERSION%%.*}"; \
if [ " CUDA_MAJOR" -ge 12 ]; then
uv pip install --system -r requirements/dev.txt;
fi
install development dependencies (for testing) RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system -e tests/vllm_test_utils
enable fast downloads from hf (for testing) RUN --mount=type=cache,target=/root/.cache/uv
uv pip install --system hf_transfer
ENV HF_HUB_ENABLE_HF_TRANSFER 1
Copy in the v1 package for testing (it isn't distributed yet) COPY vllm/v1 /usr/local/lib/python${PYTHON_VERSION}/dist-packages/vllm/v1
doc requires source code
we hide them inside test_docs/ , so that this source code
will not be imported by other tests RUN mkdir test_docs
RUN mv docs test_docs/
RUN cp -r examples test_docs/
RUN mv vllm test_docs/
RUN mv mkdocs.yaml test_docs/
#################### TEST IMAGE ####################
#################### OPENAI API SERVER ####################
base openai image with additional requirements, for any subsequent openai-style images FROM vllm-base AS vllm-openai-base
ARG TARGETPLATFORM
ARG INSTALL_KV_CONNECTORS=false
ARG PIP_INDEX_URL UV_INDEX_URL
ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out COPY requirements/kv_connectors.txt requirements/kv_connectors.txt
install additional dependencies for openai api server RUN --mount=type=cache,target=/root/.cache/uv
if [ "I N S T A L L K V C O N N E C T O R S " = " t r u e " ] ; t h e n u v p i p i n s t a l l − − s y s t e m − r r e q u i r e m e n t s / k v c o n n e c t o r s . t x t ; f i ; i f [ " INSTALL_KV_CONNECTORS" = "true" ]; then \
uv pip install --system -r requirements/kv_connectors.txt; \
fi; \
if [ " I N S T A L L K V C O N N E C T O R S " = " t r u e " ] ; t h e n uv p i p in s t a l l − − sy s t e m − r r e q u i r e m e n t s / k v c o nn ec t or s . t x t ; f i ; i f [ " TARGETPLATFORM" = "linux/arm64" ]; then
uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3];
else
uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.46.1' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3];
fi
ENV VLLM_USAGE_SOURCE production-docker-image
define sagemaker first, so it is not default from docker build FROM vllm-openai-base AS vllm-sagemaker
COPY examples/online_serving/sagemaker-entrypoint.sh .
RUN chmod +x sagemaker-entrypoint.sh
ENTRYPOINT ["./sagemaker-entrypoint.sh"]
FROM vllm-openai-base AS vllm-openai
ENTRYPOINT ["python3", "-m", "vllm.entrypoints.openai.api_server"]
#################### OPENAI API SERVER ####################
How can i run vllm serve "mistralai/Mistral-Small-3.2-24B-Instruct-2506" --port 10000 --tensor-parallel-size 2 with this docker ? It will be run on my GPU
To run the vLLM server with the model "mistralai/Mistral-Small-3.2-24B-Instruct-2506" on your GPU using the provided Docker setup, you need to:
Build the Docker image based on the given Dockerfile.
Run the container mapping your GPU and the desired port.
Inside the container, run the vllm serve command.
Step-by-step instructions:
1. Build the Docker image
The Dockerfile is set up with multiple stages. You want to build the final image named vllm-openai stage, which runs the OpenAI-compatible API server.
If you have the Dockerfile saved locally (let's say as Dockerfile), you can build the image:
bash Copy code
docker build --build-arg CUDA_VERSION=12.8.1 --build-arg PYTHON_VERSION=3.12 -t vllm:latest -f Dockerfile .
You can adjust CUDA_VERSION / PYTHON_VERSION if needed.
2. Run a container with GPU access and expose port 10000
Run the container with GPU support (--gpus all) and map port 10000:
bash Copy code
docker run --gpus all -it --rm -p 10000:10000 vllm:latest /bin/bash
This runs an interactive bash shell in the container.
3. Run the vLLM server inside the container
In the container shell, run the vLLM server with your model, port, and tensor parallel size:
bash Copy code
vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --port 10000 --tensor-parallel-size 2
This assumes:
vllm CLI is installed (which should be available if you installed the wheel).
The container can access your GPU drivers (which is ensured by the base CUDA image and --gpus all).
Optional: Run directly with docker run without bash
If you want to avoid manual shell entry, run this directly:
bash Copy code
docker run --gpus all -it --rm -p 10000:10000 vllm:latest \
vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --port 10000 --tensor-parallel-size 2
Additional notes:
Model caching/download : The model "mistralai/Mistral-Small-3.2-24B-Instruct-2506" will be downloaded from Hugging Face hub by default on the first run. Ensure your container has network access.
Memory requirements : The 24B model is large, ensure your GPU has enough memory and that --tensor-parallel-size 2 is acceptable.
Summary:
bash Copy code
# Build image
docker build --build-arg CUDA_VERSION=12.8.1 --build-arg PYTHON_VERSION=3.12 -t vllm:latest -f Dockerfile .
# Run container with GPU and exposed port
docker run --gpus all -it --rm -p 10000:10000 vllm:latest \
vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --port 10000 --tensor-parallel-size 2
This will start the vLLM server inside a GPU-enabled container, serving on port 10000.
Copy first response
Not yet included in a published release.
e d − b y = / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ] {DEADSNAKES_GPGKEY_URL} | gpg --dearmor > /etc/apt/keyrings/deadsnakes.gpg ; \
sudo chmod 644 /etc/apt/keyrings/deadsnakes.gpg ; \
echo "deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] D E A D S N A K E S G P G K E Y U R L ∣ g p g − − d e a r m or > / e t c / a pt / k ey r in g s / d e a d s nak es . g p g ; s u d oc hm o d 644/ e t c / a pt / k ey r in g s / d e a d s nak es . b y = / e t c / a pt / k ey r in g s / d e a d s nak es . g p g ]
I
G
H
T
L
Y I
N
D
E
X B
A
S
E U
R
L
/
c
u
e d − b y = / e t c / a p t / k e y r i n g s / d e a d s n a k e s . g p g ] {DEADSNAKES_GPGKEY_URL} | gpg --dearmor > /etc/apt/keyrings/deadsnakes.gpg ; \
sudo chmod 644 /etc/apt/keyrings/deadsnakes.gpg ; \
echo "deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] D E A D S N A K E S G P G K E Y U R L ∣ g p g − − d e a r m or > / e t c / a pt / k ey r in g s / d e a d s nak es . g p g ; s u d oc hm o d 644/ e t c / a pt / k ey r in g s / d e a d s nak es . b y = / e t c / a pt / k ey r in g s / d e a d s nak es . g p g ]
I
G
H
T
L
Y I
N
D
E
X B
A
S
E U
R
L
/
c
u
g
p
g
;
ec
h
o
"
d
e
b
[
s
i
g
n
e
d
−
g
p
g
;
ec
h
o
"
d
e
b
[
s
i
g
n
e
d
−