惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
人人都是产品经理
人人都是产品经理
小众软件
小众软件
博客园 - Franky
WordPress大学
WordPress大学
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
博客园 - 【当耐特】
IT之家
IT之家
G
Google Developers Blog
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
V
Visual Studio Blog
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
GbyAI
GbyAI
雷峰网
雷峰网

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Try Python without Python (using VS Code + Docker)
Yussy · 2026-05-01 · via DEV Community

What You Will Learn

In this article, we’ll cover:

  • Setting up Docker Desktop from scratch.
  • Configuring VS Code Dev Containers for a seamless workflow.
  • Running Python in a clean environment to keep your local machine clutter-free.

Introduction

I’ve always been searching for the "perfect development environment":

  • Lightweight (like VS Code)
  • Powerful (like Visual Studio)
  • Clean (no more messing up my OS with various languages)

After asking an AI for advice, I found the perfect "Triple Threat" combo: VS Code + Dev Containers + Docker.

In this post, I’ll show you how to set up this environment for Python development.

Note: I am using Windows (Japanese version), so some parts of the screenshots will be in Japanese.

Steps

Step 1: Install and Set Up Docker Desktop

Visit the official Docker website and download the installer.
Since I'm using Windows 11 Home, I chose "Download for Windows - AMD64".

Run Docker Desktop Installer.exe as an administrator.

Why you should run as administrator
If you don't run the installer with administrator privileges, it will fail with an error.
To avoid this, right-click the file and select Run as administrator.

First, check Add shortcut to desktop to create a shortcut on your desktop, then click OK to start the installation.

Once the Installation succeeded message appears, click Close.

If the installer fails because files already exist

If you encounter an error like this:

It means old Docker files are blocking the installation. To fix this, delete these two folders:

  • C:\Program Files\Docker
  • C:\ProgramData\DockerDesktop

After deleting them, run Docker Desktop Installer.exe once more.


If the installation fails with a "failed to install features" error
If you see an error about "failed to install features (exit code 50)", it means Windows virtualization features are disabled.

How to fix:

  1. Search for Turn Windows features on or off in your Start menu.

  2. Check Windows Subsystem for Linux and Virtual Machine Platform, then click OK.

  3. Restart your PC. (Note: If the process hangs after clicking OK, you can force quit it via Task Manager and then restart.)

  4. Run the Docker Desktop Installer.exe again.

After the installation, launch Docker Desktop.

Click Accept.

Continue without signing in.

Now, wait for a few moments while you see the message Starting the Docker Engine....

What if WSL is outdated?
If the engine fails to start, you may need to update WSL.
Open Windows PowerShell as an administrator and run wsl --update.
Then, click Try Again in Docker Desktop.

Once you see "Engine running," the setup is complete.

Step 2: Install the Dev Containers Extension

Launch VS Code and install the Dev Containers extension.

Step 3: Run Python in a Container

Now, let’s create a clean Python environment. We will generate the necessary configuration files to run Python inside a container.

Prepare your workspace

First, create a new folder named python-test (or any name you like) on your computer. Then, in VS Code, go to File > Open Folder and select that folder.

Add Container Configuration

Click the >< (Open a Remote Window) icon in the bottom-left corner of the VS Code window.

A menu will appear at the top. Select Add Dev Container Configuration Files....

When prompted, select "Add configuration to user data" (or workspace).

Next, choose "Python 3" from the list of definitions.

For the version, select the default (e.g., 3.14-trixie).

You will then see a list of additional features to install. You don't need any for now, so just click OK (and OK again on the next screen).

After a few moments, a folder named .devcontainer will be created, containing a devcontainer.json file. This file tells Docker how to build your environment.

Run Python in Your Container

Finally, let’s launch the container and run some code!

Click the >< icon in the bottom-left corner again and select Reopen in Container from the menu.

What if I get an error? (Check Docker Status)
If you closed your PC for a break, Docker might still be "sleeping." Docker needs to be awake to run your container.

Open Docker Desktop and make sure the status is Engine running. Once Docker is awake, try Reopen in Container again.

Once the container is ready, the bottom-left corner will show Dev Container: Python 3.

Now, create a new file named main.py in the same folder as your .devcontainer folder. (Keep the .devcontainer folder for your config files only.)

Copy and paste the following code into main.py:

print("Hello from Docker!")

import sys
print(f"Python version: {sys.version}")

Enter fullscreen mode Exit fullscreen mode

Click the "Run Python File" (triangle icon) in the top-right corner.

Congratulations! You just executed Python inside a Docker container. Your local Windows environment remains perfectly clean.

Step4: Cleaning Up and Shutting Down

When you are finished with your work, it is a good habit to close the connection and stop Docker.

Click the Dev Container: Python 3 in the bottom-left corner and select Close Remote Connection from the menu. This will safely disconnect VS Code from your Docker container.

To save your PC's resources, you should also quit Docker.
Click the ^ (Show hidden icons) in your Windows Taskbar.
Right-click the Docker whale icon.
Select Quit Docker Desktop.