How to use docker to build a python program in Visual Studio
-
EXTENSION to get dev exploer and other jupyter…
dev container is not that good
-
build a folder in the left and use ctrl shift +p to dev container: reopen in container or dev container: open folder in container
-
devcontainer.json
{
"name": "pytorch-aria",
"dockerComposeFile": "docker-compose.yml",
"runServices": ["devcontainer"],
"service": "devcontainer",
"workspaceFolder": "/home/workspace",
"customizations": {"vscode":{"extensions": [
"ms-python.python",
"esbenp.prettier-vscode",
"eamodio.gitlens"
]}}
}
- docker-compose.yml
version: "3.7"
services:
devcontainer:
build: .
image: work1:v1
container_name: work1
volumes:
- ..:/home/workspace
- ~/.ssh:/root/.ssh:ro
- ~/.gitconfig:/root/.gitconfig:ro
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
entrypoint: bash
stdin_open: true
tty: true
- dockerfile
if I add some new pip in dockerfile, you should command shift +p dev containers:rebuild container
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel
RUN apt-get update && apt-get install -y \
git \
libsparsehash-dev
RUN pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
RUN pip install matplotlib
- other exploer
8.docker
dev container中打开