Coder.comC
Coder.com13mo ago
37 replies
Some Dinosaur

Set "extensions" and "theme" from `devcontainer.json`

I'm trying to use the default template Docker (Devcontainer) and I was hoping I'd be able to hold every piece of information of how to set up the environment in the repository and not the template itself.

I have a template to just pull a GitHub repo and set it up however it wants, using it's .devcontainer/Dockerfile and .devcontainer/devcontainer.json.

I'm having problems with pulling extensions and setting the theme for the code-server. I was hoping that I could just set it from the devcontainer.json but it doesn't work - neither settings or extensions are taken into consideration when building the Workspace. Here's my devcontainer.json:
{
    "name": "Test Backend",
    "build": {
        "dockerfile": "./Dockerfile",
        "context": "."
    },
    "features": {
        "ghcr.io/devcontainers/features/common-utils:2": {
            "installZsh": "true",
            "username": "vscode",
            "userUid": "1000",
            "userGid": "1000",
            "upgradePackages": "true"
        },
        "ghcr.io/devcontainers/features/rust:1": "latest",
    "ghcr.io/devcontainers/features/git:1": {
            "version": "latest",
            "ppa": "false"
        }
    },
    "customizations": {
        "vscode": {
            "settings": {
                "workbench.colorTheme": "Visual Studio Dark"
            },
            "extensions": [
                "rust-lang.rust-analyzer"
            ]
        }
    },
    "forwardPorts": []
}
Was this page helpful?