🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › tutorial
Dev Containers tutorial
November 3, 2021 - The Dev Containers extension uses the files in the .devcontainer folder, namely devcontainer.json, and an optional Dockerfile or docker-compose.yml, to create your dev containers.
🌐
Visual Studio Code
code.visualstudio.com › docs › containers › quickstart-python
Python in a container
November 3, 2021 - Develop, build, and debug a Python app in a container, using Visual Studio Code.
🌐
GitHub
github.com › microsoft › vscode-remote-try-python
GitHub - microsoft/vscode-remote-try-python: Python sample project for trying out Dev Containers · GitHub
Tools are installed in the mcr.microsoft.com/devcontainers/python image and Dev Container settings and metadata are automatically picked up from image labels.
Starred by 919 users
Forked by 1.8K users
Languages   Python 73.7% | HTML 26.3%
🌐
GitHub
github.com › microsoft › vscode-dev-containers › blob › main › containers › python-3 › README.md
vscode-dev-containers/containers/python-3/README.md at main · microsoft/vscode-dev-containers
Beyond Python and git, this image / Dockerfile includes a number of Python tools, zsh, Oh My Zsh!, a non-root vscode user with sudo access, and a set of common dependencies for development. Given JavaScript front-end web client code written for use in conjunction with a Python back-end often requires the use of Node.js-based utilities to build, this container also includes nvm so that you can easily install Node.js. You can change the version of Node.js installed or disable its installation by updating the args property in .devcontainer/devcontainer.json.
Author   microsoft
🌐
DEV Community
dev.to › jajera › python-development-in-vscode-using-devcontainer-2ao1
Python Development in VSCode Using Devcontainer - DEV Community
December 1, 2024 - Learn how to set up and use a devcontainer-based environment for Python development in VSCode using the devcontainer-python-template.
🌐
Medium
andypickup.com › developing-in-python-with-dev-containers-part-1-setup-f1aeb89cbfed
Developing in Python with Dev Containers — Part 1: Setup | by Andy Pickup | Medium
April 15, 2024 - VSCode Command Palette — select Python container image · This will create a .devcontainer folder with a devcontainer.json file inside. This json file is super basic and just gives the container a name and the path to the container image.
🌐
Docker Hub
hub.docker.com › r › microsoft › devcontainers-python
microsoft/devcontainers-python - Docker Image
You can opt into using the vscode non-root user in the container by adding "remoteUser": "vscode" to devcontainer.json. However, by default, this you will need to use sudo to perform global pip installs. ... If you prefer, you can add the following to your Dockerfile to cause global installs to go into a different folder that the vscode user can write to. ENV PIP_TARGET=/usr/local/pip-global ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH} ENV PATH=${PIP_TARGET}/bin:${PATH} RUN if !
🌐
Reddit
reddit.com › r/vscode › python devcontainer setup for vscode
r/vscode on Reddit: Python Devcontainer Setup for VSCode
September 28, 2023 -

I'm starting to look into devcontainers with VSCode and I am looking for a container configuration (Dockerfile/devcontainer.json) that sets up a good Python development environment with some recommended extensions and settings (e.g. paths, venv, fromatting, linting) for beginners (its been some time since I was doing Python development), but that's not over-complicated.

I have the following resources that I have pieced together as a starting point and could use some input and feedback on these (I'm not sure if everything makes sense) and what to improve for a good development experience. Particularly I'm looking for input on the VSCode extensions / settings.

docker-compose.dev.yaml

version: '3.9'

networks: app-dev-network: 
    driver: bridge 
    name: app-dev-network

services:

backend:

    image: backend-dev-image
    container_name: backend-dev-container
    build:
        context: ./
        dockerfile: ./Dockerfile.dev
    volumes:
        - ..:/workspace:cache
    networks:
        - app-dev-network
    ports:
        - target: 5000 
          published: 5000

    command: sleep infinity

Dockerfile.dev

ARG VARIANT="3.11-bookworm" 
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}

RUN apt-get update && \    
apt-get upgrade --yes --no-install-recommends && \    
apt-get clean

ENV PYTHONUNBUFFERED=1

devcontainer.json

{
    "name": "Backend",
    "dockerComposeFile": [
        "./docker-compose.dev.yaml"
    ],
    "service": "backend",
    "workspaceFolder": "/workspace",

    "customizations": {  
        "vscode": {  
            "extensions": [  
                "ms-python.python",  
            ],  
            "settings": {  
                "python.pythonPath": "${workspaceFolder}/.venv/bin/python",             
                "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",  
            }  
        }  
    },

    "postCreateCommand": "pip3 install --user -r requirements.txt"
}

🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › create-dev-container
Create a Dev Container
November 3, 2021 - Python & PostgreSQL - A Python container that connects to PostgreSQL in a different container. Docker-Outside-of-Docker Compose - Includes the Docker CLI and illustrates how you can use it to access your local Docker install from inside a dev ...
Find elsewhere
🌐
Xebia
xebia.com › home › blog › how to create a devcontainer for your python project
How To Create A Devcontainer For Your Python Project | Xebia
November 21, 2022 - Devcontainers allow you to connect your IDE to a running Docker container, allowing for a native development experience but with the benefits of reproducibility and isolation. This makes easier to onboard new joiners and align development ...
🌐
GitHub
github.com › microsoft › vscode-dev-containers › blob › main › containers › python-3 › .devcontainer › devcontainer.json
vscode-dev-containers/containers/python-3/.devcontainer/devcontainer.json at main · microsoft/vscode-dev-containers
November 30, 2023 - See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own! - vscode-dev-containers/containers/python-3/.devcontainer/devcontainer.json at main · microsoft/vscode-dev-containers
Author   microsoft
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › containers
Developing inside a Container
November 3, 2021 - It allows you to open any folder inside (or mounted into) a container and take advantage of Visual Studio Code's full feature set. A devcontainer.json file in your project tells VS Code how to access (or create) a development container with ...
🌐
Medium
medium.com › @dexterwilliams04 › getting-started-with-python-3-dev-containers-4f14821fec6b
Getting Started with Python 3 Dev Containers | by Dexter Williams | Medium
October 1, 2020 - Fork VSCode’s Sample Python Project and follow the README.md to get the dev container running. ... Recall that VS Code’s Python-3 dev container depends on the official Docker Python image. Not being specific about the Python version can cause future unexpected behavior because the official Docker Python image is periodically versioned to keep up with official Python releases. ... Work within the .devcontainer directory to add custom scripts to your dev container definition.
🌐
Docker Hub
hub.docker.com › r › microsoft › vscode-devcontainers
microsoft/vscode-devcontainers - Docker Image
mcr.microsoft.com/vscode/devcontainers/python (Details⁠, History⁠, All tags⁠) 3, 3.9, 3-bullseye, 3.9-bullseye, 3-buster, 3.9-buster · 3.8, 3.8-bullseye, 3.8-buster · 3.7, 3.7-bullseye, 3.7-buster · 3.6, 3.6-bullseye, 3.6-buster ·
🌐
Towards Data Science
towardsdatascience.com › home › latest › setting a dockerized python environment – the elegant way
Setting A Dockerized Python Environment - The Elegant Way | Towards Data Science
January 21, 2025 - The Dev Containers extension makes the integration of containers with the development workflow seamless and efficient. We saw how, with a few simple steps, we can set and customize a dockerized Python environment using the devcontainer.json file.
🌐
Medium
medium.com › data-science › setting-a-dockerized-python-environment-the-elegant-way-f716ef85571d
Setting A Dockerized Python Environment — The Elegant Way | by Rami Krispin | TDS Archive | Medium
April 6, 2024 - In a nutshell, the VScode Dev Containers extension enables you to open an isolated VScode session inside a docker container seamlessly. The level of isolation includes the following three layers: ... The devcontainer.json file defines the session ...
🌐
DEV Community
dev.to › mcastellin › hands-on-with-vscode-dev-containers-33bf
Hands-On with VSCode & "Dev Containers" - DEV Community
October 23, 2020 - a devcontainer.json file: a configuration file you can use to further customize your development container build process · We first look at the Dockerfile and it should look something like this: # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/python-3/.devcontainer/base.Dockerfile # [Choice] Python version: 3, 3.8, 3.7, 3.6 ARG VARIANT="3" FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} # [Option] Install Node.js ARG INSTALL_NODE="true" ARG NODE_VERSION="lts/*" RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
🌐
Everyday DevOps
markcallen.com › addpython-project-with-devcontainers-in-vs-code
Adding DevContainers to a Python Project - Everyday DevOps
August 6, 2025 - mkdir .devcontainer · Then add ... "features": { "ghcr.io/devcontainers/features/git:1": {} } } This file tells VS Code how to build and run your container....