-
Notifications
You must be signed in to change notification settings - Fork 57
Using with VSCode and Remote Containers
Or Fleisher edited this page Jun 22, 2021
·
1 revision
- Create a project folder and open it in VS Code. Add a
.devcontainerfolder. - Create a
devcontainer.jsonfile inside it with the content as shown below. - Also create an empty
.config/blenderfolder. - Execute the container by pressing
Ctrl+⇧Shift+Pand run the commandRemote-Containers: Reopen in Container. - From the integrated terminal, run
blender.
This is the folder structure before running the container.
.
├── .devcontainer
│ └── devcontainer.json
│ ├── .config
│ │ └── blender
├── Docker (Not required)
│ └── Dockerfile
Folder structure after execution
After running the container once, including running Blender, the folder structure should look something similar to this: .
├── blender_file.blend
├── .devcontainer
│ ├── .config
│ │ └── blender
│ │ └── 2.92
│ │ └── config
│ │ ├── platform_support.txt
│ │ ├── recent-files.txt
│ │ └── userpref.blend
│ └── devcontainer.json
├── Docker
│ └── Dockerfile
{
"name": "blender",
//// Use this if you use a custom image.
//"build": {
// "dockerfile": "../Docker/Dockerfile",
// },
// Use this if you only need to run the image directly.
"image": "nytimes/blender:latest",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/root/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/root/${localWorkspaceFolderBasename}",
// We also mount the config folder from the host system. This way, settings
// inside the container are kept between runs.
"mounts": [
"source=${localWorkspaceFolder}/.devcontainer/.config/blender,target=/root/.config/blender/,type=bind"
],
"runArgs": [
"-it",
"--rm", // Removes the container on exit. Remove this if you want the container to keep running.
"--gpus", "all",
"-v", "/tmp/.X11-unix:/tmp/.X11-unix:rw",
"-v", "/tmp/.docker.xauth:/tmp/.docker.xauth:rw",
"-e", "DISPLAY=${localEnv:DISPLAY}",
"-e", "XAUTHORITY=/tmp/.docker.xauth",
"--device", "/dev/dri/card0:/dev/dri/card0"
],
"extensions": []
}See PR for more information about this guide
This repository is maintained by the Research & Development team at The New York Times and is provided as-is for your own use. For more information about R&D at the Times visit our website