I changed the original Dockerfile, because in UV documentation the Dockerfile looks this, but I guess the bin folder only applies to IOs, and for windows its called Scripts, so I changed lines 4 and 14 from /bin to /Scripts (I don't think that's the problem)

That is absolutely the problem.

You're not running in a Windows container; you're running a Linux container. The default $PATH (the variable in which the system will search for unqualified binary names like uv) typically includes /bin, but it does not include /Scripts.

By placing the uv binary in /Scripts, you have placed it where it won't be found.

  • You could add /Scripts to your $PATH, and then you could run uv and it would work.
  • You could call it with a fully qualified path, like /Scripts/uv.

But the easiest solution is to not makes changes just for the sake of changing things: put the binaries in /bin as documented and they will work as expected.


With the following Dockerfile, everything works as expected:

FROM python:3.11

# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Copy the application into the container.
COPY . /app

# Install the application dependencies.
WORKDIR /app
RUN uv sync --frozen --no-cache

# Run the application.
CMD ["/app/.venv/bin/uvicorn", "src.main:app", "--port", "80", "--host", "0.0.0.0"]
Answer from larsks on Stack Overflow
🌐
Astral
docs.astral.sh › uv › concepts › projects › sync
Locking and syncing | uv
January 9, 2026 - Similarly, commands which read ... the lockfile is not up-to-date, uv will raise an error instead of updating the lockfile. To use the lockfile without checking if it is up-to-date, use the --frozen option:...
Discussions

Have `uv sync` default to `--locked`
I was a little surprised/confused when migrating to uv that the default uv sync did not enforce that the project was synced exactly to uv.lock or else error if not. When reading through the docs, I found some references to --frozen More on github.com
🌐 github.com
3
March 21, 2025
uv sync on a docker container requires `--frozen` instead of `--locked`
Following the doc on how to use uv with docker, I have the following Dockerfile FROM nvidia/cuda:12.6.1-base-ubuntu24.04 COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ WORKDIR /app ENV UV_L... More on github.com
🌐 github.com
1
October 9, 2025
python - How to prevent unmanaged packages from being removed and set uv sync --inexact --frozen as the default behavior when using uv for dm? - Stack Overflow
When using uv for dependency management, executing uv add or uv sync removes some unmanaged packages, especially in subprojects where it removes packages from the parent project. To avoid this, I currently have to manually run uv sync --inexact --frozen every time. More on stackoverflow.com
🌐 stackoverflow.com
Add --frozen flag to "sync-and-running" documentation
There should also be in the docs a blurb about how by default uv sync updates all the lockfile and using --frozen ensures that the same version of the packages on the dev machine is used by the github actions VM. More on github.com
🌐 github.com
4
January 20, 2025
🌐
GitHub
github.com › astral-sh › uv › issues › 9379
Frozen vs Locked unexpected behavior · Issue #9379 · astral-sh/uv
November 23, 2024 - # Install python dependencies (only main, not dev 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 --frozen --no-install-project --no-dev
Author   TurtleOrangina
🌐
GitHub
github.com › astral-sh › uv › issues › 12372
Have `uv sync` default to `--locked` · Issue #12372 · astral-sh/uv
March 21, 2025 - Summary I was a little surprised/confused when migrating to uv that the default uv sync did not enforce that the project was synced exactly to uv.lock or else error if not. When reading through the docs, I found some references to --froz...
Author   johnthagen
🌐
Astral
docs.astral.sh › uv › reference › cli
Commands | uv
December 8, 2025 - To skip updating the lockfile, use --frozen. To skip updating the environment, use --no-sync. If any of the requested dependencies cannot be found, uv will exit with an error, unless the --frozen flag is provided, in which case uv will add the dependencies verbatim without checking that they ...
🌐
GitHub
yellowduck.be › posts › why-using-uv-run-frozen-matters-in-production
Why using uv run --frozen matters in production - YellowDuck.be
October 9, 2025 - Running uv with the --frozen flag ensures that dependency resolution is strictly based on your lockfile: ... Refuse to install or upgrade any dependency not listed in the lockfile. Abort if the lockfile is missing or out of sync with pyproject.toml.
🌐
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 - /app RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-dev # Then, use a final image without uv FROM python:3.12-slim-bookworm # It is important to use the image that matches the builder, as the path to the # Python executable must be the same, e.g., using `python:3.11-slim-bookworm` # will fail.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 79580245 › how-to-prevent-unmanaged-packages-from-being-removed-and-set-uv-sync-inexact
python - How to prevent unmanaged packages from being removed and set uv sync --inexact --frozen as the default behavior when using uv for dm? - Stack Overflow
When using uv for dependency management, executing uv add or uv sync removes some unmanaged packages, especially in subprojects where it removes packages from the parent project. To avoid this, I currently have to manually run uv sync --inexact --frozen every time.
🌐
GitHub
github.com › astral-sh › uv › issues › 10793
Add --frozen flag to "sync-and-running" documentation · Issue #10793 · astral-sh/uv
January 20, 2025 - name: Example jobs: uv-example: name: python runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Install the project run: uv sync --all-extras --dev --frozen - name: Run tests # For example, using `pytest` run: uv run pytest tests
Author   f0lie
🌐
GitHub
github.com › astral-sh › uv › issues › 11445
Allow providing a uv.lock file to uv sync for clarity? · Issue #11445 · astral-sh/uv
February 12, 2025 - The documentation for uv sync isn't great, since the "locking and syncing" page barely mentions uv sync, and the CLI reference clarifies things when it says "The project is re-locked before syncing unless the --locked or --frozen flag is provided.", but this phrase is a bit deep into the documentation and not too easy to find.
Author   nbelakovski
🌐
Medium
medium.com › @connect.hashblock › pythons-uv-toolchain-reproducible-envs-that-don-t-break-ci-69caeb370f4d
Python’s uv Toolchain: Reproducible Envs that Don’t Break CI | by Hash Block | Medium
October 26, 2025 - --frozen (or --locked) ensures CI uses the lock only, failing if it would need to re-lock. Because uv has a global cache, repeated jobs get dramatically faster as artifacts accumulate on the runner (and it’s space-efficient).
🌐
GitHub
github.com › astral-sh › uv › issues › 6443
`uv sync` freezes infinitely at the container root · Issue #6443 · astral-sh/uv
August 22, 2024 - It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv #6 5.969 #6 5.969 [notice] A new release of pip is available: 24.0 -> 24.2 #6 5.969 [notice] To update, run: pip install --upgrade pip #6 6.186 Using Python 3.11.9 interpreter at: /usr/local/bin/python3 #6 6.595 Resolved 5 packages in 408ms #6 DONE 6.9s #7 [4/4] RUN uv sync -vv #7 0.181 0.000526s DEBUG uv uv 0.3.1 #7 0.182 0.001037s DEBUG uv_workspace::workspace Found project root: `/home` #7 0.182 0.001310s DEBUG uv_workspace::workspace No workspace root found, using project root #7 0.182 0.001448s DEBUG
Author   sterliakov
🌐
Astral
docs.astral.sh › uv › guides › integration › docker
Using uv in Docker | uv
2 weeks ago - Note that the pyproject.toml is ... --no-install-package <name>. If you're using a workspace, then a couple changes are needed: Use --frozen instead of --locked during the initially sync....
🌐
GitHub
github.com › astral-sh › uv › issues › 15238
`uv sync` removes necessary dependencies when two packages include the same module · Issue #15238 · astral-sh/uv
August 12, 2025 - Bug Description uv sync --frozen --no-dev removes runtime dependencies (types-boto3-ecr) even though they are required in the lock file. Reproduction The full project is here in a gist, but this is what I did to get there: https://gist.g...
Author   jaseemabid
🌐
Hynek
hynek.me › articles › docker-uv
Production-ready Python Docker Containers with uv
September 24, 2024 - 2024-09-24: Added note on uv sync --frozen vs uv sync --locked and changed Dockerfile to --locked.
🌐
Stack Overflow
stackoverflow.com › questions › 79672902 › uv-fails-with-locked-even-though-running-without-it-doesnt-change-the-lock
python - uv fails with --locked, even though running without it doesn't change the lock, during Docker build - Stack Overflow
The error almost always means the uv.lock is out of sync with your pyproject.toml. All you need to do is run “uv lock” in your terminal to sync both files and then build your image again.
🌐
Reddit
reddit.com › r/python › uv cheatsheet with most common/useful commands
r/Python on Reddit: uv cheatsheet with most common/useful commands
October 10, 2025 -

I've been having lots of fun using Astral's uv and also teaching it to friends and students, so I decided to create a cheatsheet with the most common/useful commands.

uv cheatsheet with most common/useful commands

I included sections about

  • project creation;

  • dependency management;

  • project lifecycle & versioning;

  • installing/working with tools;

  • working with scripts;

  • uv's interface for pip and venv; and

  • some meta & miscellaneous commands.

The link above takes you to a page with all these sections as regular tables and to high-resolution/print-quality downloadable files you can get for yourself from the link above.

I hope this is helpful for you and if you have any feedback, I'm all ears!

🌐
GitHub
github.com › astral-sh › uv › issues › 12271
Sync --frozen does not install python version · Issue #12271 · astral-sh/uv
March 18, 2025 - Question The following command is executed by our GitHub action before running the tests. uv sync --all-packages --quiet --frozen The command fails with: error: The current Python version (3.[12](...).3) is not compatible with the locked...
Author   eruvanos