Development containers (Dev Containers) are a VS Code feature that allows developers to package a local development tool stack into the internals of a Docker container while also bringing the VS Code UI experience with them.
The project consists of the following
.devcontainer/
├── compose.yaml
└── devcontainer.json
{
"name": "devcontainr_python3",
"dockerComposeFile": "./compose.yaml",
"service": "python3",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": ["ms-python.python"]
}
}
}
item | description |
---|---|
name |
Container name visible on VS Code |
dockerComposeFile |
Specify by relative path the docker-comopse file used to create the container |
service |
Specify the service name of the container you want to open in VScode among the services in docker-compose.yml |
workspaceFolder |
Specify the root folder when the container is opened |
shutdownAction |
Setting what to do with containers when a container screen is closed in VScodestopCompose stops the container when the screen is closed |
customizations/vscode/extensions |
Specify VScode extensions to be installed with container creation |
version: "3"
services:
python3:
container_name: "python3_container"
image: "python:3.12.1-slim-bullseye"
tty: true
volumes:
- .:/workspace
item | description |
---|---|
tty |
If true, an interactive shell session can be started in the container |
volumes |
Set up with "HOST RELATIVE PATH :CONTAINER ABSOLUTE PATH " and bind the host and container volumes |
`` | |
`` |
- feature:1
- feature:2
Released under the MIT license
- github: https://github.com/shinyay
- twitter: https://twitter.com/yanashin18618
- mastodon: https://mastodon.social/@yanashin