How to build vllm docker image for different CUDA version

I tried to build a vllm docker image in dev stage for CUDA 12.6.

# The 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.6.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:${CUDA_VERSION}-devel-ubuntu20.04
# TODO: Restore to base image after FlashInfer AOT wheel fixed
ARG FINAL_BASE_IMAGE=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04

# 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.
#
# Reference: https://pip.pypa.io/en/stable/installation/#get-pip-py
ARG GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"

# 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=${PIP_INDEX_URL}
ARG UV_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}

# PyTorch provides its own indexes for standard and nightly builds
ARG PYTORCH_CUDA_INDEX_BASE_URL=https://download.pytorch.org/whl
ARG PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL=https://download.pytorch.org/whl/nightly

# 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.
#
# Reference: https://pip.pypa.io/en/stable/topics/authentication/#keyring-support
ARG PIP_KEYRING_PROVIDER=disabled
ARG UV_KEYRING_PROVIDER=${PIP_KEYRING_PROVIDER}

# Flag enables built-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 ${DEADSNAKES_MIRROR_URL} ] ; then \
        if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then \
            mkdir -p -m 0755 /etc/apt/keyrings ; \
            curl -L ${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] ${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 python${PYTHON_VERSION} python${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 ${GET_PIP_URL} | python${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
# Reference: https://github.com/astral-sh/uv/pull/1694
ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
# Use copy mode to avoid hardlink failures with Docker cache mounts
ENV UV_LINK_MODE=copy

# Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
# 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

# Workaround for https://github.com/openai/triton/issues/2507 and
# https://github.com/pytorch/pytorch/issues/107960 -- hopefully
# this won't be needed for future versions of this docker image
# or future versions of triton.
RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/

WORKDIR /workspace

# install build and runtime dependencies
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 ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(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
# see https://github.com/pytorch/pytorch/pull/123243
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}
#################### BASE 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
# Reference: https://github.com/astral-sh/uv/pull/1694
ENV UV_HTTP_TIMEOUT=500
ENV UV_INDEX_STRATEGY="unsafe-best-match"
# Use copy mode to avoid hardlink failures with Docker cache mounts
ENV UV_LINK_MODE=copy

# Install libnuma-dev, required by fastsafetensors (fixes #20384)
RUN apt-get update && apt-get install -y libnuma-dev && rm -rf /var/lib/apt/lists/*
COPY requirements/lint.txt requirements/lint.txt
COPY requirements/test.in requirements/test.in
RUN uv pip compile requirements/test.in -o requirements/test.txt --index-strategy unsafe-best-match --torch-backend cu126
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 ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
#################### DEV IMAGE ####################

COPY requirements/build.txt requirements/build.txt
RUN uv pip install --system -r requirements/build.txt \
    --extra-index-url https://download.pytorch.org/whl/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
RUN git clone https://github.com/vllm-project/vllm.git /workspace/vllm
WORKDIR /workspace/vllm
RUN VLLM_USE_PRECOMPILED=1 uv pip install --system -e . --verbose
RUN python3 tools/generate_cmake_presets.py
RUN cmake --preset release
RUN cmake --build --preset release --target install

However, I get this error:

#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 8.69kB done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/nvidia/cuda:12.6.1-devel-ubuntu20.04
#2 DONE 0.1s

#3 [internal] load .dockerignore
#3 transferring context: 387B done
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 279B done
#4 DONE 0.0s

#5 [base  1/11] FROM docker.io/nvidia/cuda:12.6.1-devel-ubuntu20.04@sha256:36d0e505435c9871f20301e64cf33b95af8ec98bee1a1a40e11a0d029326b654
#5 resolve docker.io/nvidia/cuda:12.6.1-devel-ubuntu20.04@sha256:36d0e505435c9871f20301e64cf33b95af8ec98bee1a1a40e11a0d029326b654 done
#5 sha256:36d0e505435c9871f20301e64cf33b95af8ec98bee1a1a40e11a0d029326b654 743B / 743B done
#5 sha256:e04465e3de8e1b7b1666d4808c58c9cec971e20f00df1725a64f8d07320606b0 2.63kB / 2.63kB done
#5 sha256:c00ec9529ce96fcf3f2c608b7f543661d27cf4e1d7f23e69b17fc0dcd111e656 18.60kB / 18.60kB done
#5 sha256:2e5f43b05769018e843282b18315d21e21e9f9d950000ec3ffb163be0b5a55ed 0B / 7.95MB 0.1s
#5 sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 0B / 27.51MB 0.1s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 0B / 57.32MB 0.1s
#5 sha256:2e5f43b05769018e843282b18315d21e21e9f9d950000ec3ffb163be0b5a55ed 2.10MB / 7.95MB 0.3s
#5 sha256:2e5f43b05769018e843282b18315d21e21e9f9d950000ec3ffb163be0b5a55ed 7.95MB / 7.95MB 0.4s done
#5 sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 6.29MB / 27.51MB 0.5s
#5 sha256:95f9a179bf48518c33c53a4a9840b2b63cdb6ae4bcee77396736d7543ba7f2f7 0B / 184B 0.5s
#5 sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 14.68MB / 27.51MB 0.7s
#5 sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 22.02MB / 27.51MB 0.8s
#5 sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 27.51MB / 27.51MB 0.9s done
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 8.39MB / 57.32MB 1.0s
#5 sha256:95f9a179bf48518c33c53a4a9840b2b63cdb6ae4bcee77396736d7543ba7f2f7 184B / 184B 0.8s done
#5 sha256:22e17e21b5e69ddd0e26d8b510fb892ce7d40988cbc62bc0a02647d91a11368a 6.88kB / 6.88kB 0.9s done
#5 sha256:974ab5140f59ed79b82f09fca6e4a2b2d8758cf206911ba4a5ac7824641abee1 0B / 62.66kB 1.0s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 11.53MB / 57.32MB 1.1s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 0B / 1.38GB 1.1s
#5 extracting sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 0.1s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 14.68MB / 57.32MB 1.2s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 19.92MB / 57.32MB 1.3s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 23.07MB / 57.32MB 1.4s
#5 sha256:974ab5140f59ed79b82f09fca6e4a2b2d8758cf206911ba4a5ac7824641abee1 62.66kB / 62.66kB 1.3s done
#5 sha256:6796e5a442aa65dd4e1363e0b0f9df61dc7a24e2454c907209f22fc206d3e00e 0B / 1.68kB 1.4s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 27.26MB / 57.32MB 1.5s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 32.51MB / 57.32MB 1.6s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 38.80MB / 57.32MB 1.8s
#5 sha256:6796e5a442aa65dd4e1363e0b0f9df61dc7a24e2454c907209f22fc206d3e00e 1.68kB / 1.68kB 1.7s done
#5 sha256:062243f07a161191996da4d76ea072f4e284c262afb1b414fe20e8880255935a 0B / 1.52kB 1.8s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 41.94MB / 57.32MB 1.9s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 50.33MB / 57.32MB 2.1s
#5 sha256:062243f07a161191996da4d76ea072f4e284c262afb1b414fe20e8880255935a 1.52kB / 1.52kB 2.2s
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 54.53MB / 57.32MB 2.3s
#5 extracting sha256:9ea8908f47652b59b8055316d9c0e16b365e2b5cee15d3efcb79e2957e3e7cad 1.2s done
#5 sha256:062243f07a161191996da4d76ea072f4e284c262afb1b414fe20e8880255935a 1.52kB / 1.52kB 2.2s done
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 0B / 2.46GB 2.3s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 74.45MB / 1.38GB 2.5s
#5 extracting sha256:2e5f43b05769018e843282b18315d21e21e9f9d950000ec3ffb163be0b5a55ed
#5 sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 57.32MB / 57.32MB 2.6s done
#5 sha256:8dbca574f4496d93fdfb7f90342c2654d2c13c85ad1c972339f2de30654d1085 0B / 86.53kB 2.6s
#5 extracting sha256:2e5f43b05769018e843282b18315d21e21e9f9d950000ec3ffb163be0b5a55ed 0.5s done
#5 extracting sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6
#5 sha256:8dbca574f4496d93fdfb7f90342c2654d2c13c85ad1c972339f2de30654d1085 86.53kB / 86.53kB 3.0s done
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 143.65MB / 1.38GB 3.6s
#5 extracting sha256:a520b738a1928f918752be1a968b72878a28ee7cd4b66a79fe7f02be91fdddf6 1.2s done
#5 extracting sha256:95f9a179bf48518c33c53a4a9840b2b63cdb6ae4bcee77396736d7543ba7f2f7 done
#5 extracting sha256:22e17e21b5e69ddd0e26d8b510fb892ce7d40988cbc62bc0a02647d91a11368a
#5 extracting sha256:22e17e21b5e69ddd0e26d8b510fb892ce7d40988cbc62bc0a02647d91a11368a done
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 222.30MB / 1.38GB 4.7s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 295.70MB / 1.38GB 5.9s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 127.93MB / 2.46GB 6.5s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 368.05MB / 1.38GB 7.0s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 442.50MB / 1.38GB 8.2s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 513.80MB / 1.38GB 9.5s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 257.95MB / 2.46GB 10.3s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 585.11MB / 1.38GB 10.9s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 658.51MB / 1.38GB 12.4s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 384.83MB / 2.46GB 13.4s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 730.86MB / 1.38GB 13.6s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 801.11MB / 1.38GB 14.8s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 873.46MB / 1.38GB 16.2s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 515.90MB / 2.46GB 16.7s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 943.72MB / 1.38GB 17.4s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.01GB / 1.38GB 18.8s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.09GB / 1.38GB 20.0s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 646.97MB / 2.46GB 20.4s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.16GB / 1.38GB 21.4s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.23GB / 1.38GB 22.4s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.30GB / 1.38GB 23.5s
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.37GB / 1.38GB 25.0s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 776.99MB / 2.46GB 25.0s
#5 extracting sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0
#5 sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 1.38GB / 1.38GB 27.8s done
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 900.73MB / 2.46GB 28.3s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.03GB / 2.46GB 31.4s
#5 extracting sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 5.2s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.16GB / 2.46GB 34.6s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.28GB / 2.46GB 37.8s
#5 extracting sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 10.2s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.40GB / 2.46GB 41.5s
#5 extracting sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 15.4s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.53GB / 2.46GB 44.1s
#5 extracting sha256:ae24f52c21c3f4f17c740f724c7e796741a5a02bb271b6904d4b852b68b169a0 16.4s done
#5 extracting sha256:974ab5140f59ed79b82f09fca6e4a2b2d8758cf206911ba4a5ac7824641abee1
#5 extracting sha256:974ab5140f59ed79b82f09fca6e4a2b2d8758cf206911ba4a5ac7824641abee1 done
#5 extracting sha256:6796e5a442aa65dd4e1363e0b0f9df61dc7a24e2454c907209f22fc206d3e00e done
#5 extracting sha256:062243f07a161191996da4d76ea072f4e284c262afb1b414fe20e8880255935a done
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.66GB / 2.46GB 47.4s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.78GB / 2.46GB 50.6s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 1.91GB / 2.46GB 53.9s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 2.04GB / 2.46GB 57.4s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 2.17GB / 2.46GB 61.0s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 2.29GB / 2.46GB 64.0s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 2.42GB / 2.46GB 67.4s
#5 sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 2.46GB / 2.46GB 68.7s done
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 5.1s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 10.1s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 15.2s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 20.3s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 25.4s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 30.5s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 35.6s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 40.6s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 45.7s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 50.7s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 55.8s
#5 extracting sha256:d1d81c665dbaf2e37255df9112b5c2a66542957094a2120521bbd1293df249f6 59.9s done
#5 extracting sha256:8dbca574f4496d93fdfb7f90342c2654d2c13c85ad1c972339f2de30654d1085
#5 extracting sha256:8dbca574f4496d93fdfb7f90342c2654d2c13c85ad1c972339f2de30654d1085 done
#5 DONE 130.4s

#6 [base  2/11] 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 ${DEADSNAKES_MIRROR_URL} ] ; then         if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then             mkdir -p -m 0755 /etc/apt/keyrings ;             curl -L ${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] ${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 python3.12 python3.12-dev python3.12-venv     && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1     && update-alternatives --set python3 /usr/bin/python3.12     && ln -sf /usr/bin/python3.12-config /usr/bin/python3-config     && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12     && python3 --version && python3 -m pip --version
#6 0.510 Get:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease [1581 B]
#6 1.182 Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Packages [2758 kB]
#6 17.06 Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [128 kB]
#6 17.94 Get:4 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [4801 kB]
#6 18.82 Get:5 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [33.1 kB]
#6 18.82 Get:6 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [1308 kB]
#6 18.85 Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [4432 kB]
#6 63.36 Err:8 http://archive.ubuntu.com/ubuntu focal InRelease
#6 63.36   Connection failed [IP: 91.189.91.82 80]
#6 78.79 Get:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB]
#6 79.41 Get:10 http://archive.ubuntu.com/ubuntu focal-backports InRelease [128 kB]
#6 79.64 Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [4919 kB]
#6 85.29 Get:12 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [4998 kB]
#6 91.74 Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1599 kB]
#6 93.78 Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [36.8 kB]
#6 93.95 Get:15 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]
#6 94.11 Get:16 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]
#6 94.19 Fetched 25.4 MB in 1min 34s (271 kB/s)
#6 94.19 Reading package lists...
#6 94.91 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Connection failed [IP: 91.189.91.82 80]
#6 94.91 W: Some index files failed to download. They have been ignored, or old ones used instead.
#6 94.95 Reading package lists...
#6 95.47 Building dependency tree...
#6 95.54 Reading state information...
#6 95.55 E: Unable to locate package ccache
#6 ERROR: process "/bin/sh -c 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 ${DEADSNAKES_MIRROR_URL} ] ; then         if [ ! -z \"${DEADSNAKES_GPGKEY_URL}\" ] ; then             mkdir -p -m 0755 /etc/apt/keyrings ;             curl -L ${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] ${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 python${PYTHON_VERSION} python${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 ${GET_PIP_URL} | python${PYTHON_VERSION}     && python3 --version && python3 -m pip --version" did not complete successfully: exit code: 100
------
 > [base  2/11] 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 ${DEADSNAKES_MIRROR_URL} ] ; then         if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then             mkdir -p -m 0755 /etc/apt/keyrings ;             curl -L ${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] ${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 python3.12 python3.12-dev python3.12-venv     && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1     && update-alternatives --set python3 /usr/bin/python3.12     && ln -sf /usr/bin/python3.12-config /usr/bin/python3-config     && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12     && python3 --version && python3 -m pip --version:
85.29 Get:12 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [4998 kB]
91.74 Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1599 kB]
93.78 Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [36.8 kB]
93.95 Get:15 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]
94.11 Get:16 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]


95.47 Building dependency tree...
95.54 Reading state information...
95.55 E: Unable to locate package ccache
------
Dockerfile:83
--------------------
  82 |     # Install Python and other dependencies
  83 | >>> RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
  84 | >>>     && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
  85 | >>>     && apt-get update -y \
  86 | >>>     && apt-get install -y ccache software-properties-common git curl sudo \
  87 | >>>     && if [ ! -z ${DEADSNAKES_MIRROR_URL} ] ; then \
  88 | >>>         if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then \
  89 | >>>             mkdir -p -m 0755 /etc/apt/keyrings ; \
  90 | >>>             curl -L ${DEADSNAKES_GPGKEY_URL} | gpg --dearmor > /etc/apt/keyrings/deadsnakes.gpg ; \
  91 | >>>             sudo chmod 644 /etc/apt/keyrings/deadsnakes.gpg ; \
  92 | >>>             echo "deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] ${DEADSNAKES_MIRROR_URL} $(lsb_release -cs) main" > /etc/apt/sources.list.d/deadsnakes.list ; \
  93 | >>>         fi ; \
  94 | >>>     else \
  95 | >>>         for i in 1 2 3; do \
  96 | >>>             add-apt-repository -y ppa:deadsnakes/ppa && break || \
  97 | >>>             { echo "Attempt $i failed, retrying in 5s..."; sleep 5; }; \
  98 | >>>         done ; \
  99 | >>>     fi \
 100 | >>>     && apt-get update -y \
 101 | >>>     && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \
 102 | >>>     && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
 103 | >>>     && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
 104 | >>>     && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
 105 | >>>     && curl -sS ${GET_PIP_URL} | python${PYTHON_VERSION} \
 106 | >>>     && python3 --version && python3 -m pip --version
 107 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c 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 ${DEADSNAKES_MIRROR_URL} ] ; then         if [ ! -z \"${DEADSNAKES_GPGKEY_URL}\" ] ; then             mkdir -p -m 0755 /etc/apt/keyrings ;             curl -L ${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] ${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 python${PYTHON_VERSION} python${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 ${GET_PIP_URL} | python${PYTHON_VERSION}     && python3 --version && python3 -m pip --version" did not complete successfully: exit code: 100

Is the vllm offical docker designed to build docker images for multiple CUDA versions?

The official vLLM Dockerfile is designed to support multiple CUDA versions by parameterizing the base image with the CUDA_VERSION build argument. However, successful builds depend on the availability of compatible CUDA base images and required packages (like ccache) for the specific Ubuntu/CUDA combination you choose. Your error (E: Unable to locate package ccache) is due to missing or outdated package lists, often caused by network issues or the chosen Ubuntu/CUDA image not having all expected packages in its repositories. This is not a limitation of vLLM’s Dockerfile design, but rather of the underlying image and network environment. See official vLLM Docker docs and related issues.

Would you like more detail on troubleshooting this specific error or on multi-CUDA support in vLLM Dockerfiles?

Sources: