Skip to content

Using a .devcontainer setup causes issues with volume mounts for .venv within the dev container. #40

@tiefenthaler

Description

@tiefenthaler

I tried to define a dev container setup with vscode for development. The purpose is to define a template to use uv to develop python projects (source code layout) within a devcontainer with vs code alongside without using vs code. Therefore I want to define a dev container setup with a Docker.debug, docker-compose.yml and devcontainer.json file.

Issue:
The "new (in the container)" create .venv to reflect the container os does neither exists in the defined (standard) root folder of the project when creating it in the config of the devcontainer.json via the "postCreateCommand": {"uv-sync--frozen--no-install-project": "uv sync --frozen --no-install-project"} nor when using the terminal within the running container uv sync --frozen --no-install-project. The .venv file is excluded during build by using .dockerignore. The mount should enable volume bind for the project code on the one side and a separate mount of the container .venv should persist the .venv within the container.

Find the setup in the git repo:
https://github.com/tiefenthaler/dev-container-uv-datascience/tree/venv-mount-issue

FYI: The repo also contains the use of docker for production, which all works perfekt.

Would be great for any information how to solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions