When VSCode launches a Dev Container, it bind-mounts your project into /workspaces/<project>, and sets that as the working directory. However, your Dockerfile installs dependencies into /app/.venv, which VSCode doesn't see.
To fix this, simply align your WORKDIR in the Dockerfile with the directory VSCode uses. That way, uv will create the .venv right where VSCode expects it.
Something like this should work:
FROM python:3.12-slim
ADD https://astral.sh/uv/install.sh /install.sh
RUN chmod +x /install.sh && /install.sh && rm /install.sh
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /workspaces/<project>
COPY pyproject.toml ./
RUN uv sync --dev
Answer from aran on Stack OverflowGitHub
github.com › a5chin › python-uv
GitHub - a5chin/python-uv: A production-ready Python development environment template using modern tools: uv for blazing-fast package management, Ruff for lightning-fast linting and formatting, ty for fast and reliable type checking, and VSCode Dev Containers for reproducible development environments. · GitHub
# Run container docker run -it --rm -v $(pwd):/workspace python-uv
Starred by 363 users
Forked by 69 users
Languages Python 92.5% | Dockerfile 7.5%
Tigrisdata
tigrisdata.com › blog › dev-containers-python
Standardizing Python Environments with Development Containers | Tigris Object Storage
July 3, 2025 - This editor preconfiguration means you can fix problems like “What version of Python do I need?” or “How do I just install the dependencies?” forever. Take tigrisdata-community/huggingface-datasets-with-tigris for example. Its devcontainer.json answers that question for you: { // ... "postCreateCommand": "uv python install && uv venv && uv sync", "remoteEnv": { "UV_LINK_MODE": "copy", "UV_PYTHON": "3.10" } // ...
python - VSCode devcontainer and UV - Stack Overflow
I'm developing using VSCode's devcontainer, and I used pip with a requirements.txt file for a few years with no problems. Works like charm. I'd like to upgrade to using uv, but I'm encountering a p... More on stackoverflow.com
Request: Official uv devcontainer
Would be really cool if we could get an official uv devcontainer for remote development using common IDEs (VS Code, PyCharm). It isn't too difficult to install uv in the Dockerfile by hand but an official option would be great. Currently the Python devcontainers are published version-by-version, ... More on github.com
Template for Python Development with CUDA in Dev Containers
If Pytorch is also needed in the container, the Cresset Template is a lot more flexible, though it runs mamba by default. More on reddit.com
Installing dependencies with `uv sync` system-wide in a Docker image
UV pip compile pyproject > requirement.txt UV pip install -r requirement.txt More on reddit.com
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
23:59
How to create a Dev Container for your project in Visual Studio ...
11:03
uv - Docker setup with a FastAPI application! | Using uv in ...
GitHub
github.com › dunnkers › python-uv-devcontainer
GitHub - dunnkers/python-uv-devcontainer: Python project setup using a Devcontainer and uv.
Upon opening the Devcontainer, setup will start. Wait for the setup to finish before continuing. ... Enter Ctrl+Shift+P and select Python: Select Interpreter. Select the venv (./.venv/bin/python). ... You now have a fully configured Python development environment! ... A workflow is already set up for you. This workflow runs tests using pytest and formatting + linting using ruff. Dependencies are set up with uv.
Author dunnkers
Astral
docs.astral.sh › uv › guides › integration › docker
Using uv in Docker | uv
1 week ago - Use one of the above images with uv pre-installed or install uv by copying the binary from the official distroless Docker image: ... FROM python:3.12-slim-trixie # The installer requires curl (and certificates) to download the release archive RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates # Download the latest installer ADD https://astral.sh/uv/install.sh /uv-installer.sh # Run the installer then remove it RUN sh /uv-installer.sh && rm /uv-installer.sh # Ensure the installed binary is on the `PATH` ENV PATH="/root/.local/bin/:$PATH"
Medium
medium.com › @ebojacky › revolutionizing-software-development-a-deep-dive-into-development-containers-uv-and-just-9c53b5f78b8f
Revolutionizing Software Development: A Deep Dive into Development Containers, uv, and just | by Ebo Jackson | Medium
June 11, 2025 - You’ll see Python 3.11 and the installed packages (numpy, pandas). Team Collaboration: Share the .devcontainer folder in your repository for consistent setups. Clean Up: Delete the container to remove all dependencies, keeping your host system clean. Cross-Platform: Works on Windows, macOS, Linux, or cloud environments. uv ...
GitHub
github.com › philippschmalen › devcontainer-python-uv-template
GitHub - philippschmalen/devcontainer-python-uv-template: Production-ready VSCode Devcontainer with fast and lightweight build using two-staged Docker build with `uv`. Uses `docker-compose` to spin up multiple services. · GitHub
# When prompted, or using the Command Palette (Ctrl+Shift+P), select: # > Dev Containers: Open Folder in Container (or similar) # after build you should see # CTRL+p > Python: Select Interpreter > /home/nonroot/.venv/bin/python (as defined in `Dockerfile`) Add dependencies: uv add <package-name> (runs inside the container) pre-commit (linting, formatting, testing) runs automatically on commit · want to ignore files that are specific to you without using .gitignore? Add them to .git/info/exclude · Want to use an already authenticated az cli from the host? Add this to the following files: // .devcontainer/devcontainer.json "features": { ...
Author philippschmalen
Simon Willison
til.simonwillison.net › github › codespaces-devcontainers
Configuring GitHub Codespaces using devcontainers | Simon Willison’s TILs
August 12, 2025 - { "name": "Python 3.13", "image": "mcr.microsoft.com/devcontainers/python:3.13-bullseye", "features": { "ghcr.io/devcontainers/features/node:1": { "version": "latest" } }, "customizations": { "vscode": { "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", "python.linting.enabled": true }, "extensions": [ "ms-python.python", "ms-python.vscode-pylance", "ms-python.vscode-python-envs", "GitHub.copilot" ] } }, "postCreateCommand": "pip install uv" }
Dataduel
dataduel.co › home › running uv in dev containers & github actions
Running uv in dev containers & github actions – DataDuel.co
April 24, 2024 - Then you can run `uv pip install --system -r requirements.txt in your devcontainer to add libraries as needed. Now that we are using system python in our dev container, we also need to add one step to get the perms setup in CI.
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 › issues › 8737
Request: Official uv devcontainer · Issue #8737 · astral-sh/uv
October 31, 2024 - Would be really cool if we could get an official uv devcontainer for remote development using common IDEs (VS Code, PyCharm). It isn't too difficult to install uv in the Dockerfile by hand but an official option would be great. Currently the Python devcontainers are published version-by-version, ...
Author rdong8
Mjunya
mjunya.com › en › posts › 2025-06-15-python-template
Modern Python Development Environment Template with uv, ruff, devcontainer, Claude Code | MJUN Tech Note
June 15, 2025 - Honestly, you might think it’s unnecessary since uv’s virtual environments make it easy to set up environments, but the advantages of devcontainer are reducing OS differences and isolating and aligning VSCode extensions. This template uses devcontainer during coding with VSCode or Cursor to provide a unified Python development environment. devcontainer configuration is written in the .devcontainer/devcontainer.json file. Below is an example of devcontainer.json configuration used in this template.
GitHub
github.com › muetaek0321 › uv-devcontainer-template
GitHub - muetaek0321/uv-devcontainer-template: uvを使用したPython環境のdevcontainer · GitHub
必要なライブラリをインストール インストール時は下記のコマンドを実行 [package]はインストールしたいライブラリ名を入れてください。(numpy, pandasなど) uv add [package]
Author muetaek0321
DeepWiki
deepwiki.com › philippschmalen › devcontainer-python-uv-template › 4.2-dependency-management-with-uv
Dependency Management with uv | philippschmalen/devcontainer-python-uv-template | DeepWiki
February 27, 2026 - This page covers the `uv` package manager workflow used in this project: how dependencies are declared, locked, installed, and upgraded. It also documents the full transitive dependency graph as recor