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 Overflow
🌐
Jeroen Overschie
jeroenoverschie.nl › python-devcontainer-with-uv
Python Devcontainer with uv - Jeroen Overschie
October 2, 2025 - Devcontainer Features are pieces of installation code which can be added to your Devcontainer in modular fashion. They are shareable and there is a large collection of features available for us to use. So is the case for uv! There is a Devcontainer feature for uv.
Discussions

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 ... More on github.com
🌐 github.com
9
October 31, 2024
Improve devcontainer experience, particularly when switching from pip to uv.
When I then add --system to get ... -r .devcontainer/requirements.txt", I get another error: Built pypika==0.48.9 Prepared 134 packages in 8.74s error: Failed to install: websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (websockets==15.0.1) Caused by: failed to create directory `/usr/local/lib/python3.12/site-packages/websockets-15.0.1.dist-info`: Permission denied (os error 13) Ideally, a user could simply add a uv feature to a devcontainer, ... More on github.com
🌐 github.com
14
March 15, 2025
Devcontainer + vscode + uv + robotcode
I’d like to setup a project for a robotframework library robotframework-xyz providing library XyzLibrary which is consistent with uv (src/robotframework_xyz) as well as the naming convention of RF libs (XyzLibrary). The project structure: robotframework-xyz .devcontainer/ devcontainer.json ... More on forum.robotframework.org
🌐 forum.robotframework.org
9
0
April 14, 2025
🌐
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 - Cross-Platform: Works on Windows, macOS, Linux, or cloud environments. uv is a high-performance Python package and environment manager designed to replace tools like Poetry, Conda, and venv.
🌐
Medium
daniel-mannino.medium.com › better-python-programming-with-dev-containers-uv-and-ruff-a56ed7172d9e
Better Python programming with Dev Containers, uv, and ruff | by Daniel Mannino | Medium
December 6, 2024 - This article describes my macbook setup for coding in Python. The setup leverages VScode, Dev Containers, uv, and ruff.
🌐
Ivan Lee
ivanlee.me › devcontainers-in-2025-a-personal-take
Devcontainers in 2025: A Personal Take - Ivan Lee
March 2, 2025 - Use a base image like mcr.microsoft.com/devcontainers/base:debian-12 and configure your programming languages and tools from scratch. This is particularly useful if you have a very specific dependencies, like to use tooling manage multiple versions (e.g. pyenv or uv while writing a Python library), or like to live on the bleeding edge ("official" language-specific base images can lag behind by several months). Additionally you can use development container features (community-owned configuration scripts) to further customize your container.
🌐
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 ...
Author   rdong8
🌐
GitHub
github.com › va-h › devcontainers-features › tree › main › src › uv
devcontainers-features/src/uv at main · va-h/devcontainers-features
Enable or disable uv and uvx autocompletion. ... Note: This file was auto-generated from the devcontainer-feature.json.
Author   va-h
Find elsewhere
🌐
GitHub
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
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 ...
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 - 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" } // ...
🌐
Simon Willison
til.simonwillison.net › github › codespaces-devcontainers
Configuring GitHub Codespaces using devcontainers | Simon Willison’s TILs
August 12, 2025 - You can find a list of more features in the devcontainers/features repository, again in the src/ directory. That features/node:1 one is defined by this install.sh script. I copied the "vscode" block from Pamela, but I added the "GitHub.copilot" extension to enable Copilot in VS Code out of the box. ... Anything in postCreateCommand will be run after the container is first created. Here I'm using pip to install uv, after which uv tool install X etc will be available.
🌐
GitHub
github.com › astral-sh › uv › issues › 12197
Improve devcontainer experience, particularly when switching from pip to uv. · Issue #12197 · astral-sh/uv
March 15, 2025 - Summary I tried changing an existing devcontainer to use uv instead of pip, and I ran into the error mentioned in ##11599. Initial devcontainer.json with only uv added: { "name": "Example", "image": "mcr.microsoft.com/devcontainers/pytho...
Author   jtkiley
🌐
Development Containers
containers.dev › features
Available Dev Container Features
Development containers documentation and specification page.
🌐
Docker Hub
hub.docker.com › r › jfxs › devcontainer-uv
jfxs/devcontainer-uv - Docker Image
.devcontainer/devcontainer.json configuration to develop inside a container⁠: ... lint: desc: "Python lint with Ruff." cmds: - uv run ruff check silent: true format: desc: "Python format with Ruff." cmds: - uv run ruff check --fix - uv run ruff format silent: true Copy
🌐
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
Production-ready VSCode Devcontainer with fast and lightweight build using two-staged Docker build with `uv`. Uses `docker-compose` to spin up multiple services. - philippschmalen/devcontainer-python-uv-template
Author   philippschmalen
🌐
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 - devcontainer.json configuration includes the following items: features: Specifies features to add to the development environment. Using features allows installing tools like uv and Claude Code without writing new Dockerfiles.
🌐
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
🌐
GitHub
github.com › devcontainers › features
GitHub - devcontainers/features: A collection of Dev Container Features managed by Dev Container spec maintainers. See https://github.com/devcontainers/feature-starter to publish your own · GitHub
Missing a CLI or language in your otherwise perfect container image? Add the relevant Feature to the features property of a devcontainer.json.
Starred by 1.4K users
Forked by 590 users
Languages   Shell
🌐
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.