| Property | Value |
|---|---|
| Severity | Info |
| Category | Best-practices |
| Default | Enabled (experimental) |
| Auto-fix | Yes (AI AutoFix, unsafe) |
Description
This rule fires on Dockerfiles that:- Use a GPU/PyTorch-oriented base image (
nvidia/cuda:*,nvcr.io/nvidia/*,pytorch/pytorch:*cuda*, or a stage that inherits CUDA from one of these). - Install Python/ML packages (e.g.
torch,torchvision,transformers,flash-attn,xformers) viaconda,mamba, ormicromamba. - Do not rely on a heavy conda environment-management workflow (no
conda env create, noenvironment.yml/conda-lock.ymlcopied into the image).
Why this matters
- Conda resolution on GPU images is slow and can pull in unused Anaconda channels.
- Many GPU images use conda only as a Python package installer — uv is a closer fit with
pip install uv && uv pip install --index-url https://download.pytorch.org/whl/cuXYZ .... - uv supports explicit CUDA wheel indexes, which makes the CUDA alignment story (see also
tally/gpu/cuda-version-mismatch) simpler and more auditable.
Examples
Violation
No violation
Auto-fix
When the rule fires, it attaches an unsafe, asyncSuggestedFix backed by the AI AutoFix resolver. The AI agent is asked to:
- Replace conda/mamba/micromamba Python/ML installs with
uv pip install .... - Install uv before its first use (via
pip install uvor the official installer). - Preserve the base image and OS package installs.
- Preserve runtime invariants in the final stage (
CMD,ENTRYPOINT,USER,WORKDIR,ENV,LABEL,EXPOSE,HEALTHCHECK). - Output
NO_CHANGEif the file is better left alone (e.g. anenvironment.yml-driven workflow snuck past detection).
--fix --fix-unsafe- A configured ACP-capable agent in the config file (see the top-level
[ai]section)
Applicability
The rule fires when all of the following hold for one stage:- The stage is GPU-oriented:
- base image resolves to
nvidia/cuda:*(ornvcr.io/nvidia/*,nvidia/cudagl:*), or - base image resolves to
pytorch/pytorch:*(ornvcr.io/nvidia/pytorch:*), or StageFacts.CUDAMajor > 0(inherited via a stage reference).
- base image resolves to
- A
RUNinvokesconda,mamba, ormicromambawith aninstallsubcommand that lists at least one known Python/ML package. - The Dockerfile as a whole does not show signs of a heavier conda workflow:
- no
conda env create/mamba env create/micromamba env createin anyRUN - no
environment.yml,environment.yaml,conda-lock.yml, orconda-lock.yamlin the build context
- no