Docker Hub
hub.docker.com › r › astral › uv
astral/uv - Docker Image
To run a uv command in an image, use one of the derived images, e.g.: docker run -it --rm astral/uv:bookworm-slim uv --version Copy · See the uv Docker integration guide for more details. See the available images documentation for a description of uv's Docker image tagging scheme.
Astral
docs.astral.sh › uv › guides › integration › docker
Using uv in Docker | uv
2 weeks ago - In the context of a multi-stage Docker image, --no-editable can be used to include the project in the synced virtual environment from one stage, then copy the virtual environment alone (and not the source code) into the final image. ... # Install uv FROM python:3.12-slim AS builder COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # Use the system Python across both stages ENV UV_PYTHON_DOWNLOADS=0 # Change the working directory to the `app` directory WORKDIR /app # Install dependencies RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --locked --no-install-project --no-editable # Copy the project into the intermediate image COPY .
Videos
17:14
Easy Python Package Management with UV Inside Docker | A FastAPI ...
10:49
How To Use uv in Production - Simple Docker Setup - YouTube
11:03
uv - Docker setup with a FastAPI application! | Using uv in ...
01:31
Does UV make Docker Containers Easy? #python #programming #coding ...
25:16
uv IS the Future of Python Packaging 🐍📦 - YouTube
GitHub
github.com › astral-sh › uv-docker-example
GitHub - astral-sh/uv-docker-example: An example of using uv in Docker images · GitHub
An example project for using uv in Docker images, with a focus on best practices for developing with the project mounted in the local image.
Starred by 762 users
Forked by 74 users
Languages Dockerfile 81.4% | Shell 16.2% | Python 2.4%
GitHub
github.com › astral-sh › uv-docker-example › blob › main › Dockerfile
uv-docker-example/Dockerfile at main · astral-sh/uv-docker-example
An example of using uv in Docker images. Contribute to astral-sh/uv-docker-example development by creating an account on GitHub.
Author astral-sh
Astral
docs.astral.sh › uv › guides › integration › docker › index.md
[Using uv in Docker](using-uv-in-docker) [Getting started](getting-started) Tip
As with the distroless image, each derived image is published with uv version tags as ghcr.io/astral-sh/uv:{major}.{minor}.{patch}-{base} and ghcr.io/astral-sh/uv:{major}.{minor}-{base}, e.g., ghcr.io/astral-sh/uv:0.11.3-alpine. In addition, starting with 0.8 each derived image also sets UV_TOOL_BIN_DIR to /usr/local/bin to allow uv tool install to work as expected with the default user. For more details, see the GitHub Container page. Use one of the above images with uv pre-installed or install uv by copying the binary from the official distroless Docker image:
Medium
medium.com › @benitomartin › deep-dive-into-uv-dockerfiles-by-astral-image-size-performance-best-practices-5790974b9579
Deep Dive into uv Dockerfiles by Astral: Image Size, Performance & Best Practices | by Benito Martin | Medium
March 18, 2025 - Before we dive into pros, cons, and differences, let’s quickly describe each Dockerfile. An example of using a single stage with uv pre-installed. # Use a Python image with uv pre-installed FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim # Install the project into `/app` WORKDIR /app # Enable bytecode compilation ENV UV_COMPILE_BYTECODE=1 # Copy from the cache instead of linking since it's a mounted volume ENV UV_LINK_MODE=copy # Install the project's dependencies using the lockfile and settings RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --frozen --no-install-project --no-dev # Then, add the rest of the project source code and install it ADD .
Docker
hub.docker.com › layers › astral › uv › latest › images › sha256-eebcd8fb6dbb13145244d4f5f2fc196cb5885944899c99d445ec3b147493e1bb
Image Layer Details - astral/uv:latest
© 2026 Docker, Inc. All rights reserved. | Terms of Service | Subscription Service Agreement | Privacy | Legal
GitHub
github.com › astral-sh › uv › blob › main › docs › guides › integration › docker.md
uv/docs/guides/integration/docker.md at main · astral-sh/uv
In the context of a multi-stage Docker image, --no-editable can be used to include the project in the synced virtual environment from one stage, then copy the virtual environment alone (and not the source code) into the final image. ... # Install uv FROM python:3.12-slim AS builder COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # Use the system Python across both stages ENV UV_PYTHON_DOWNLOADS=0 # Change the working directory to the `app` directory WORKDIR /app # Install dependencies RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --locked --no-install-project --no-editable # Copy the project into the intermediate image COPY .
Author astral-sh
Reddit
reddit.com › r/python › best practices for using python & uv inside docker
r/Python on Reddit: Best practices for using Python & uv inside Docker
October 11, 2025 -
Getting uv right inside Docker is a bit tricky and even their official recommendations are not optimal.
It is better to use a two-step build process to eliminate uv from the final image size.
A two-step build process not only saves disk space but also reduces attack surface against security vulerabilities
Top answer 1 of 5
174
You’re skipping past the first solution they offer, which is the more efficient distroless solution. You can literally just copy the standalone uv binary directly into your image; you don’t need to base your entire image on theirs. COPY --from=ghcr.io/astral-sh/uv:0.9.2 /uv /bin/ This takes ~43MiB, not the 77MiB you cite.
2 of 5
52
The linked security issue is a bad example. If an attacker can use uv in your container, they could also download and run whatever executable they want and do not need to exploit bugs in uv for that. With very few exceptions, CVEs in unused executables in containers are almost never an issue, because if the attacker already has shell access to be able to use them, they won't gain anything from exploiting those bugs.
Docker Hub
hub.docker.com › u › astral
astral (Astral Software)
astral · The official Docker image for uv, the Python package manager.
Astral
docs.astral.sh › uv › getting-started › installation
Installation | uv
2 weeks ago - See our guide on using uv in Docker for more details. uv release artifacts can be downloaded directly from GitHub Releases. Each release page includes binaries for all supported platforms as well as instructions for using the standalone installer via github.com instead of astral.sh.
Astral
docs.astral.sh › uv › guides › integration
Integration guides | uv
March 23, 2026 - Learn how to integrate uv with other software: Using in Docker images · Using with Jupyter notebooks · Using with marimo notebooks · Using with pre-commit · Using in GitHub Actions · Using in GitLab CI/CD · Installing PyTorch · Building a FastAPI application ·
Hynek
hynek.me › articles › docker-uv
Production-ready Python Docker Containers with uv
September 24, 2024 - Starting with 0.3.0, Astral’s uv brought many great features, including support for cross-platform lock files uv.lock. Together with subsequent fixes, it has become Python’s finest workflow tool for my (non-scientific) use cases. Here’s how I build production-ready containers, as fast ...
GitHub
github.com › astral-sh › uv-docker-example › blob › main › multistage.Dockerfile
uv-docker-example/multistage.Dockerfile at main · astral-sh/uv-docker-example
An example of using uv in Docker images. Contribute to astral-sh/uv-docker-example development by creating an account on GitHub.
Author astral-sh
Docker
hub.docker.com › layers › astral › uv › 0.9.2-python3.14-alpine › images › sha256-721ea35780db35fc41f19f9566d659605a2c4105d395c837521741cae79403b1
Image Layer Details - astral/uv:0.9.2-python3.14-alpine
0.9.2-python3.14-alpine · © 2026 Docker, Inc. All rights reserved. | Terms of Service | Subscription Service Agreement | Privacy | Legal