How to run vLLM with Docker: Complete Installation and Optimization Guide

Last update: December 6th 2026
  • Implementation of a high-performance inference engine using containers to optimize KV memory management.
  • Setting up Docker environments compatible with CUDA and ROCm to maximize LLM response speed.
  • Production deployment strategies using tensor parallelism and quantization to reduce infrastructure costs.

Modern server racks in a data center, representing the infrastructure needed to deploy vLLM at scale.

If you've ventured into the world of Large Language Models, you know that making them respond quickly without overloading your graphics card is a real headache. This is where vLLM comes in, a tool developed by the SkyComputing Lab at UC Berkeley that has come to change the game, allowing for extremely efficient and fast inference thanks to intelligent memory management.

For those of us who don't want to complicate our lives by grappling with Python dependencies or driver versions, using Docker is undoubtedly the most reliable approach. This technology allows us to package everything necessary in a container, preventing the operating system from malfunctioning and ensuring that the inference engine works exactly the same on any machine with the appropriate hardware.

What makes vLLM so special?

Close-up detail of a server chassis with blue lighting, evoking cutting-edge technology and the deployment of Docker containers.

What truly sets vLLM apart from other options is its algorithm called PagedAttention. Simply put, this system treats the KV cache like a computer's virtual memory, dividing it into small blocks. This prevents memory fragmentation and reduces VRAM waste by up to four times, meaning we can load much larger batches of data onto the GPU.

Furthermore, it uses a technique known as continuous batching. Unlike older systems that waited for the entire group of requests to finish, vLLM adds new requests as soon as a sequence ends, keeping the GPU working at full capacity and lowering latency for the end user.

Installation and deployment using Docker

Systems engineer managing server infrastructure using a tablet in a modern data center.

If you're looking for the most stable way to get started, pre-built images are your best option. The standard image vllm/vllm-openai It is the most common, but there are specific variations depending on the hardware, such as labels. -cu129 for CUDA 12.9 or vllm-openai-rocm For those using AMD accelerators. To launch the server, it is essential to use the flag --ipc=host, since it is the one that allows for proper communication between processes in configurations with multiple GPUs.

  Google launches Gemma 3: its new open AI optimized for a single GPU

An important detail for those of us who work in Windows is that, although vLLM is native to Linux, we can use WSL2 to run Docker. If you find that your NVIDIA drivers are outdated, you can enable the environment variable. VLLM_ENABLE_CUDA_COMPATIBILITY=1This automatically configures the necessary libraries for the container. works with outdated drivers, provided that it concerns professional GPUs or data centers.

Resource and performance optimization

Close-up of high-performance graphics cards, essential components for VRAM management and fast vLLM inference.

Once you have the container running, don't stick with the default settings if you want to get the most out of the machine. The parameter --gpu-memory-utilization This controls how much memory the engine reserves; the standard value is 0.92, but if you start noticing insufficient memory errors, you can lower it to 0.80 or 0.85 to give the system a break.

Another masterstroke is adjusting the --max-model-lenIf you don't need the model to remember endless conversations, reduce the context length. This frees up a huge amount of memory, allowing you to process more simultaneous requests without the server crashing. For massive deployments, tensor parallelism through --tensor-parallel-size It is the key to distributing the load between several graphics cards.

Advanced management and persistence

If you frequently delete and create containers, you'll find that boot times can be frustratingly slow because the system recompiles Torch artifacts. To fix this, the ideal solution is assemble a named volume in the route /root/.cache/vllm (or in /home/vllm/ (if you are not using the root user). This way, the build cache persists and the second boot is Too much faster.

For those who need maximum security in corporate environments, it is recommended to run the container with a non-root user using the tag opt-invllm-openai-nonrootThis is vital on platforms like OpenShift, where the container is required. adapts to arbitrary UIDs and that the cache volumes have write permissions for group 0.

  How to use Artificial Intelligence without registration or account

Comparison with other inference tools

It's common to confuse vLLM with Ollama or Docker Model Runner. While Ollama is fantastic for quick local or single-user testing due to its simplicity, vLLM is designed for large-scale production . vLLM can be up to 14 times faster than basic HuggingFace implementations thanks to its optimized CUDA kernels.

Docker Model Runner, on the other hand, is a more general-purpose solution that allows you to run various types of models (such as Stable Diffusion), but it doesn't implement the deep optimizations of PagedAttention. The ideal strategy is usually to develop and experiment locally with simple tools and then migrate to vLLM when user traffic starts to increase and infrastructure costs become a concern.

Troubleshooting common problems

The most common error is the dreaded OOM (Out Of Memory). If it occurs at startup, the problem is usually the KV cache budget; try reducing it. --max-model-lenIf this happens while the server is already running, the CUDA graphics may be consuming too much; in that case, try adding more resources. --enforce-eager all with disable graphics capture and see if that stabilizes the memory.

If you notice that the server takes forever to report that it's ready, remember that weight loading and JIT compilation are the bottlenecks. You can use the command vllm preload to keep the weights in GPU memory, allowing engine restarts to be almost instantaneous by CPI charge.

Implementing vLLM via Docker transforms a powerful GPU into a professional inference server capable of handling thousands of tokens per second with astonishing efficiency. By combining memory paging, continuous batch processing, and proper configuration of volumes and environment variables, a robust, scalable, and OpenAI API-compatible system is achieved, drastically reducing operating costs compared to traditional deployment methods.

  How to summarize PDF files with artificial intelligence: A complete guide to optimize your reading

FAQ

How do I fix the insufficient memory error in vLLM Docker?

You can reduce the value of `--gpu-memory-utilization` to 0.80 or decrease the maximum context length with `--max-model-len`. It's also recommended to use quantized versions of the model to reduce the VRAM footprint.

Is it possible to run vLLM on Windows with Docker?

Yes, it's possible using WSL2 as the base for running Docker containers. You must ensure that your NVIDIA drivers are up to date and that Docker Desktop has access to the GPU.

What is the purpose of the --ipc=host flag in the Docker command?

This option is essential in multi-GPU setups as it enables the inter-process communication necessary for tensor parallelism.

How can I make the vLLM container start faster?

The most effective approach is to mount a persistent volume in the vLLM cache path to reuse build artifacts or use the vllm preload function to keep the loads on the GPU.

What is the difference between vLLM and Ollama in terms of usage?

Ollama is optimized for ease of use and local single-user experimentation, while vLLM is designed for production services with high concurrency and maximum performance.

What should I do if I have old CUDA drivers on my machine?

The VLLM_ENABLE_CUDA_COMPATIBILITY environment variable must be set to 1 or true when launching the container to activate the pre-installed compatibility libraries.

How can I run vLLM without using the root user in Docker?

You must use the build target opt-invllm-openai-nonroot and ensure that the mounted volume paths are under /home/vllm and have write permissions for group 0.

TecnoDigital

TecnoDigital

Passionate about technology and software development, I delve into the world of systems and computing with the aim of fostering innovation and solving complex challenges.