Recommended Driver >=460.32.03

TensorFlow 2.11.0 + CUDA 11.2

Generate a production-ready Dockerfile with verified compatibility

Configuration Summary

Framework
TensorFlow 2.11.0
CUDA Version
11.2
Python Support
3.7, 3.8, 3.9, 3.10
Min Driver
>=460.32.03

Note: 稳定的 TF 2.x 中期版本

Install Command
pip install tensorflow==2.11.0

What's in TensorFlow 2.11.0

  • Stable TensorFlow 2.x mid-cycle release
  • Improved Keras API stability
  • Enhanced mixed precision training
  • Better CUDA 11.2 optimization

Incremental improvements over 2.10, preparing for 2.12+ changes

Best For

Use Cases

  • Long-term production deployments
  • Systems requiring TF 2.11.x compatibility
  • Bridge between TF 2.10 and 2.12+

CUDA 11.2 Advantages

  • Legacy GPU support
  • Windows native development (TF 2.10)
  • Older system compatibility

Limitations: Limited to older TensorFlow versions

Generate Dockerfile

Configuration

Local GPU or CPU environment

稳定的 TF 2.x 中期版本

Requires NVIDIA Driver >=460.32.03
Dockerfile
1# syntax=docker/dockerfile:1
2# ^ Required for BuildKit cache mounts and advanced features
3
4# Generated by DockerFit (https://tools.eastondev.com/docker)
5# TENSORFLOW 2.11.0 + CUDA 11.2 | Python 3.11
6# Multi-stage build for optimized image size
7
8# ==============================================================================
9# Stage 1: Builder - Install dependencies and compile
10# ==============================================================================
11FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 AS builder
12
13# Build arguments
14ARG DEBIAN_FRONTEND=noninteractive
15
16# Environment variables
17ENV PYTHONUNBUFFERED=1
18ENV PYTHONDONTWRITEBYTECODE=1
19ENV TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6"
20
21# Install Python 3.11 and build tools (native)
22RUN apt-get update && apt-get install -y --no-install-recommends \
23 python3.11 \
24 python3.11-venv \
25 python3.11-dev \
26 build-essential \
27 git
28 && rm -rf /var/lib/apt/lists/*
29
30# Create virtual environment
31ENV VIRTUAL_ENV=/opt/venv
32RUN python3.11 -m venv $VIRTUAL_ENV
33ENV PATH="$VIRTUAL_ENV/bin:$PATH"
34
35# Upgrade pip
36RUN pip install --no-cache-dir --upgrade pip setuptools wheel
37
38# Install TensorFlow with BuildKit cache
39RUN --mount=type=cache,target=/root/.cache/pip \
40 pip install tensorflow==2.11.0
41
42# Install project dependencies
43COPY requirements.txt .
44RUN --mount=type=cache,target=/root/.cache/pip \
45 pip install -r requirements.txt
46
47# ==============================================================================
48# Stage 2: Runtime - Minimal production image
49# ==============================================================================
50FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 AS runtime
51
52# Labels
53LABEL maintainer="Generated by DockerFit"
54LABEL version="2.11.0"
55LABEL description="TENSORFLOW 2.11.0 + CUDA 11.2"
56
57# Environment variables
58ENV PYTHONUNBUFFERED=1
59ENV PYTHONDONTWRITEBYTECODE=1
60ENV NVIDIA_VISIBLE_DEVICES=all
61ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
62
63# Install runtime dependencies (native Python 3.11)
64RUN apt-get update && apt-get install -y --no-install-recommends \
65 python3.11 \
66 libgomp1
67 && rm -rf /var/lib/apt/lists/*
68
69# Create non-root user for security
70ARG USERNAME=appuser
71ARG USER_UID=1000
72ARG USER_GID=$USER_UID
73RUN groupadd --gid $USER_GID $USERNAME \
74 && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
75
76# Copy virtual environment from builder
77COPY --from=builder --chown=$USERNAME:$USERNAME /opt/venv /opt/venv
78ENV VIRTUAL_ENV=/opt/venv
79ENV PATH="$VIRTUAL_ENV/bin:$PATH"
80
81# Set working directory
82WORKDIR /app
83
84# Copy application code
85COPY --chown=$USERNAME:$USERNAME . .
86
87# Switch to non-root user
88USER $USERNAME
89
90# Expose port
91EXPOSE 8000
92
93# Default command
94CMD ["python", "main.py"]
🚀 Recommended

High-Performance GPU Cloud

Deploy your Docker containers with powerful NVIDIA GPUs. A100/H100 available, 32+ global locations.

  • NVIDIA A100/H100 GPU instances
  • Hourly billing, starting at $0.004/h
  • 32+ global data centers
  • One-click container & bare metal deployment
🎁 Deploy Now

Frequently Asked Questions

What NVIDIA driver version do I need?

For TensorFlow 2.11.0 with CUDA 11.2, you need NVIDIA driver version >=460.32.03 or higher.

Run nvidia-smi to check your current driver version.

How do I install TensorFlow with CUDA support?

TensorFlow 2.11.0 uses the following installation command:

pip install tensorflow==2.11.0

Since TensorFlow 2.15+, CUDA libraries are bundled via tensorflow[and-cuda].

How do I verify GPU access in the container?

After building your image, run:

docker run --gpus all your-image python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

This should show available GPU devices.