Update documentation for running in a container (#11052)

This PR rewords the instructions for using uv in a container. I'm a new
user and was somewhat confused by it, so I've rewritten it as I'd have
liked to have read it.

It makes it more clear what distroless means, to avoid confusion with
other projects that ship OS files with an image with its tag name clear
of qualifiers(`astral-sh/uv`, in this case). An example of that is
caddy, which ships with alpine.

This also modifies the original example to use a distroful image instead
of distroless one while #8635 doesn't get resolved.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Danilo Rezende 2025-01-29 21:17:58 -03:00 committed by GitHub
parent 35ded6d7e1
commit eb8ffa4981
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 7 deletions

View File

@ -14,25 +14,28 @@ description:
Check out the [`uv-docker-example`](https://github.com/astral-sh/uv-docker-example) project for Check out the [`uv-docker-example`](https://github.com/astral-sh/uv-docker-example) project for
an example of best practices when using uv to build an application in Docker. an example of best practices when using uv to build an application in Docker.
### Running uv in a container uv provides both _distroless_ Docker images, which are useful for
[copying uv binaries](#installing-uv) into your own image builds, and images derived from popular
base images, which are useful for using uv in a container. The distroless images do not contain
anything but the uv binaries. In contrast, the derived images include an operating system with uv
pre-installed.
A Docker image is published with a built version of uv available. To run a uv command in a As an example, to run uv in a container using a Debian-based image:
container:
```console ```console
$ docker run ghcr.io/astral-sh/uv --help $ docker run --rm -it ghcr.io/astral-sh/uv:debian uv --help
``` ```
### Available images ### Available images
uv provides a distroless Docker image including the `uv` binary. The following tags are published: The following distroless images are available:
- `ghcr.io/astral-sh/uv:latest` - `ghcr.io/astral-sh/uv:latest`
- `ghcr.io/astral-sh/uv:{major}.{minor}.{patch}`, e.g., `ghcr.io/astral-sh/uv:0.5.25` - `ghcr.io/astral-sh/uv:{major}.{minor}.{patch}`, e.g., `ghcr.io/astral-sh/uv:0.5.25`
- `ghcr.io/astral-sh/uv:{major}.{minor}`, e.g., `ghcr.io/astral-sh/uv:0.5` (the latest patch - `ghcr.io/astral-sh/uv:{major}.{minor}`, e.g., `ghcr.io/astral-sh/uv:0.5` (the latest patch
version) version)
In addition, uv publishes the following images: And the following derived images are available:
<!-- prettier-ignore --> <!-- prettier-ignore -->
- Based on `alpine:3.20`: - Based on `alpine:3.20`:
@ -67,7 +70,7 @@ In addition, uv publishes the following images:
- `ghcr.io/astral-sh/uv:python3.8-bookworm-slim` - `ghcr.io/astral-sh/uv:python3.8-bookworm-slim`
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
As with the distroless image, each image is published with uv version tags as 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}.{patch}-{base}` and
`ghcr.io/astral-sh/uv:{major}.{minor}-{base}`, e.g., `ghcr.io/astral-sh/uv:0.5.25-alpine`. `ghcr.io/astral-sh/uv:{major}.{minor}-{base}`, e.g., `ghcr.io/astral-sh/uv:0.5.25-alpine`.