🌐
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
1 week 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 .
🌐
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 .
🌐
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
Find elsewhere
🌐
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
1 week 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.
🌐
DeepWiki
deepwiki.com › astral-sh › uv › 11.3-docker-images-and-distribution
Docker Images and Distribution | astral-sh/uv | DeepWiki
March 25, 2026 - This document describes the Docker image build system, image variants, and distribution mechanisms for `uv`. This covers how Docker images are built as part of the release pipeline and published to co
🌐
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 ...
🌐
Cogit8
rob.cogit8.org › posts › optimizing-django-docker-builds-with-astrals-uv
Optimizing Django Docker Builds with Astral’s `uv` | Rob's Cogitations
June 1, 2025 - COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv · This approach uses Docker’s multi-stage capabilities to grab the uv binary without needing to install it through pip or other package managers.
🌐
Mkennedy
mkennedy.codes › home › posts › docker images using uv's python
Docker images using uv's python • Michael Kennedy's Thoughts on Technology
February 5, 2026 - FROM linuxbase:latest # our customized Ubuntu ENV PATH=/venv/bin:$PATH ENV PATH=/root/.cargo/bin:$PATH # install uv RUN curl -LsSf https://astral.sh/uv/install.sh | sh # set up a virtual env to use for whatever app is destined for this container.
🌐
Astral
docs.astral.sh › uv › getting-started › installation › index.md
[Installing uv](installing-uv) [Installation methods](installation-methods)
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.