🌐
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 container by volume mounting the Docker Unix socket. After you make your selection, VS Code will add the appropriate .devcontainer/devcontainer.json (or .devcontainer.json) file to the folder.
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › tutorial
Dev Containers tutorial
November 3, 2021 - Get started with development Containers in Visual Studio Code
Discussions

Python Devcontainer Setup for VSCode
You don't really need a separate virtualenv if you're using a container. More on reddit.com
🌐 r/vscode
2
1
September 28, 2023
Looking for assistance with VSCode Devcontainers and Python
I don’t put those settings in the devcontainer.json. I always put them in a .vscode/settings.json in the root of the project and vs code always seems to pick them up. More on reddit.com
🌐 r/vscode
4
0
September 21, 2023
Use Python interpreter in Docker container in VS Code
I installed Django using Cookiecutter template and am using VS Code as my IDE. But opening Python files shows error squiggles as my default Python… More on reddit.com
🌐 r/vscode
5
3
July 9, 2024
Build a node and python dev container image.
Just grab the mcr.microsoft.com/devcaintainers/base:debian image and use the python and node/typescript features from containers.dev/features. The 'official' images use those anyway. More on reddit.com
🌐 r/devops
10
1
July 11, 2024
🌐
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.
🌐
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 - On top of python:3.10, we install Java and the required pip packages. The .devcontainer folder is in place, so it’s now time to open our Devcontainer. First, make sure you have the Dev Containers extension installed in VSCode (previously called “Remote - Containers”. That done, if you open your repo again, the extension should already detect your Devcontainer:
🌐
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
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 !
Author   microsoft
🌐
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"
}

🌐
GitHub
github.com › microsoft › vscode-remote-try-python
GitHub - microsoft/vscode-remote-try-python: Python sample project for trying out Dev Containers · GitHub
Python sample project for trying out Dev Containers - microsoft/vscode-remote-try-python
Starred by 919 users
Forked by 1.8K users
Languages   Python 73.7% | HTML 26.3%
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › containers
Developing inside a Container
November 3, 2021 - Developing inside a Container using Visual Studio Code Remote Development
Find elsewhere
🌐
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 this tutorial, we reviewed how to set a dockerized Python environment with VScode and the Dev Containers extension. 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
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 - Developing in Python with Dev Containers — Part 1: Setup A quick guide to getting up and running with Python using a dev container in Visual Studio Code What exactly are Dev Containers? At the risk …
🌐
GitHub
github.com › jwlai-cloud › vscode-devcontainer-python
GitHub - jwlai-cloud/vscode-devcontainer-python: Setting Python Development Environment with VScode and Docker
The devcontainer.json defines and customizes the container and VScode setting, such as: Image settings - defines the image build method or if to pull an existing one · Project settings such as extensions to install and command to execute during the launch time of the container · Let's start with a practical example by setting the environment using the same image we build in the first example above (e.g., rkrispin/vscode-python:ex1).
Author   jwlai-cloud
🌐
GitHub
github.com › RamiKrispin › vscode-python
GitHub - RamiKrispin/vscode-python: A Tutorial for Setting Python Development Environment with VScode and Docker · GitHub
The devcontainer.json defines and customizes the container and VScode setting, such as: Image settings - defines the image build method or if to pull an existing one · Project settings such as extensions to install and command to execute during the launch time of the container · Let's start with a practical example by setting the environment using the same image we build in the first example above (e.g., rkrispin/vscode-python:ex1).
Starred by 952 users
Forked by 99 users
Languages   Shell 67.0% | Dockerfile 26.1% | Python 6.9%
🌐
YouTube
youtube.com › microsoft developer
Set up a dev container for your Python app in Visual Studio Code - YouTube
In this demo, Luciana Abud uses the Remote Containers extension in Visual Studio Code to auto configure a dev container for a FlaskAPI + PostgreSQL app. Watc...
Published   May 25, 2021
Views   17K
🌐
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.
🌐
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 - In this tutorial, we reviewed how to set a dockerized Python environment with VScode and the Dev Containers extension. 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.
🌐
YouTube
youtube.com › watch
Get Started with Dev Containers in VS Code - YouTube
Learn how Dev Containers can boost your coding productivity and save you time configuring your development environment. Follow along with the demo to discove...
Published   September 5, 2023
🌐
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.
🌐
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.
🌐
GitHub
github.com › 0916dhkim › vscode-devcontainer-tutorial
GitHub - 0916dhkim/vscode-devcontainer-tutorial: Tutorial for Setting up Devcontainer in Visual Studio Code · GitHub
Tutorial for Setting up Devcontainer in Visual Studio Code - 0916dhkim/vscode-devcontainer-tutorial
Starred by 103 users
Forked by 18 users
Languages   JavaScript 69.6% | Dockerfile 30.4%