Illustrated title card for the guide: Multi-GPU vLLM Docker Setup and NCCL Troubleshooting

Multi-GPU vLLM Docker Setup and NCCL Troubleshooting

Run vLLM on two NVIDIA GPUs in Docker, pick a compatible tensor-parallel size, verify a local chat request, and diagnose NCCL startup hangs.

Expose the NVIDIA GPUs you want to use with Docker’s --gpus option, then set vLLM’s --tensor-parallel-size to the number of GPUs taking part in a compatible split. For the two-GPU setup below, use --tensor-parallel-size 2. If startup hangs, rerun with NCCL_DEBUG=INFO and use the communication check to troubleshoot separately from model loading. Docker GPU access · vLLM parallelism · NVIDIA NCCL environment variables · vLLM troubleshooting

Check GPU access in Docker

Start on a Linux host with Docker Engine, a compatible NVIDIA driver and the NVIDIA Container Toolkit configured for Docker. The Linux x86-64 build of the vLLM 0.33.0 image below uses CUDA 13.0. Check the host driver against NVIDIA’s CUDA compatibility table. vLLM GPU requirements · NVIDIA Container Toolkit setup · vLLM image tag · NVIDIA CUDA compatibility

List the host GPUs, then verify that Docker sees the two selected devices. Replace 0,1 with the indices you want. Keep the nested quotes around the comma-separated device list. Docker GPU access · NVIDIA sample workload

nvidia-smi -L
docker run --rm --runtime=nvidia --gpus '"device=0,1"' ubuntu nvidia-smi

Proceed when the second command lists both selected GPUs. If it fails, revisit the driver and Docker runtime configuration using the NVIDIA Container Toolkit setup guide.

Choose a tensor-parallel size

Choose the GPU count for one model replica, then check that the model’s total attention head count divides evenly by that count. Qwen publishes 16 attention heads for Qwen/Qwen3-0.6B, so two GPUs pass that check with eight heads per GPU. Three GPUs fail the divisibility check for this model. vLLM parallelism · vLLM model validation · Qwen model configuration

If your model fits across the host’s GPUs but the model cannot be split evenly at your chosen size, vLLM documents an alternative using --tensor-parallel-size 1 and --pipeline-parallel-size set to the GPU count. Pipeline parallelism splits the model by layers. vLLM parallelism

Start vLLM and send a request

Run the vLLM image with the same two GPU indices. --shm-size=1g sets the container’s shared-memory size to the example value in NVIDIA’s NCCL guide. vLLM uses PyTorch, which shares data between processes through shared memory, particularly for tensor-parallel inference. vLLM Docker guide · vLLM image tag · Docker run reference · NVIDIA NCCL runtime troubleshooting

Keep the loopback address in the port mapping for this local check. Docker warns that on releases before 28.0.0, other hosts on the same Layer 2 segment can reach ports published to localhost. Docker port publishing

docker run --rm --name vllm-tp --runtime=nvidia --gpus '"device=0,1"' \
  --shm-size=1g \
  -v ~/.cache/huggingface:/root/.cache/huggingface \
  -p 127.0.0.1:8000:8000 \
  vllm/vllm-openai:v0.33.0 \
  --model Qwen/Qwen3-0.6B --tensor-parallel-size 2

Once the server has started, send a chat request from another terminal on the Docker host. Look for a chat completion. Use the same model ID in the request and launch command. vLLM chat quickstart

curl http://127.0.0.1:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"Qwen/Qwen3-0.6B","messages":[{"role":"user","content":"Say hello."}]}'

Troubleshoot NCCL startup

If the container is still running, stop it with docker stop vllm-tp. To get NCCL debug output on the next run, add --env NCCL_DEBUG=INFO before the image name in the launch command. Docker stop reference · Docker run reference · NVIDIA NCCL environment variables

What you seeWhat to try
An NCCL warning about failing to extend a file in /dev/shmIncrease --shm-size if the container has insufficient shared memory, then retry. NVIDIA’s Docker example also sets --ulimit memlock=-1 when adjusting pinned memory limits. NVIDIA NCCL runtime troubleshooting
A suspected GPU peer-to-peer issueRun nvidia-smi topo -p2p p on the host and inspect the selected pair’s PCIe peer-access status. Use nvidia-smi topo -p2p n for NVLink. NVIDIA NCCL GPU troubleshooting
A hang that might involve NCCL’s peer-to-peer transportCompare with one rerun using --env NCCL_P2P_DISABLE=1 before the image name. If that helps, investigate the peer-to-peer path. Remove the flag after diagnosis, since disabling that transport can affect performance. NVIDIA NCCL GPU troubleshooting · vLLM troubleshooting

Run the communication check

Stop the serving container if it is still running. Save the Python script from vLLM’s hardware and driver troubleshooting section as test.py in your current folder. Run it in the same image with the same GPU pair and one torchrun process per GPU. Docker run reference · Docker bind mounts

docker run --rm --runtime=nvidia --gpus '"device=0,1"' \
  --shm-size=1g \
  --env NCCL_DEBUG=TRACE \
  --mount "type=bind,src=$PWD/test.py,dst=/tmp/test.py,readonly" \
  --entrypoint torchrun   vllm/vllm-openai:v0.33.0 \
  --nproc-per-node=2 /tmp/test.py

Look for the script’s NCCL success messages. If the script hangs or crashes, investigate the hardware and driver setup before retrying the model server. vLLM troubleshooting

For setups spanning more than one host, see vLLM’s multi-node deployment guide. Browse the site’s Articles or Topics.

Evidence and limits. The setup was adapted from the vLLM 0.33.0, Docker Engine, NVIDIA Container Toolkit and NCCL 2.32.3 documentation, checked on November 26, 2026. The commands were not run for this guide.

Related