Skip to content

Instantly share code, notes, and snippets.

@ikibalnyi
Last active April 7, 2026 09:30
Show Gist options
  • Select an option

  • Save ikibalnyi/5973db158c26821c2cc0cd626d8c399c to your computer and use it in GitHub Desktop.

Select an option

Save ikibalnyi/5973db158c26821c2cc0cd626d8c399c to your computer and use it in GitHub Desktop.
Devcontainers setup for VS Code + Run docker-in-docker to isolate devcontainer from host
{
"name": "{{PROJECT_NAME}}",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"installOhMyZsh": true
},
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
"plugins": "git docker docker-compose"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"dockerDashComposeVersion": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "24",
"pnpmVersion": "latest"
}
},
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"ms-vscode.vscode-typescript-next",
"sst-dev.opencode",
"pmneo.tsimporter"
],
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
},
"runArgs": ["--name", "{{PROJECT_NAME}}"],
"postCreateCommand": "sudo mkdir -p /root/.local/share/opencode && sudo chown -R $USER:$USER ./node_modules && pnpm install",
"forwardPorts": [3000,5173], // Ports your projects use
"portsAttributes": {
"3000": {
"label": "Web App",
"onAutoForward": "openBrowser"
}
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/{{PROJECT_NAME}},type=bind",
"workspaceFolder": "/workspaces/{{PROJECT_NAME}}",
"containerEnv": {
// "SSH_AUTH_SOCK": "/ssh-agent.sock"
},
"mounts": [
// "source=${env:SSH_AUTH_SOCK},target=/ssh-agent.sock,type=bind",
"source=node-modules,target=/workspaces/{{PROJECT_NAME}}/node_modules/,type=volume",
"source=opencode-data,target=/root/.local/share/opencode,type=volume",
]
}
FROM mcr.microsoft.com/devcontainers/base:noble
WORKDIR /workspaces/{{PROJECT_NAME}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment