Coder.comC
Coder.com16mo ago
12 replies
molitann

Envbuilder in Coder: wrong user is used when cache is enabled

Hello, when I build image for the first time, the correct user, specified in .devcontainer is used. But when the pod is restarted and image is pulled from cache, it ALWAYS uses root user which then fails, because only the specified user has private SSH key in their .ssh which can pull from remote repository. This happens regardless of ENVBUILDER_REMOTE_REPO_BUILD_MODE set to true or false.

devcontainer:
{
    "build": {
        "dockerfile": "./Dockerfile",
        "context": "."
    },
    "features": {
        "ghcr.io/devcontainers/features/common-utils:2": {
            "installZsh": "true",
            "configureZshAsDefaultShell": "true",
            "username": "mmolisch",
            "userUid": "6043",
            "userGid": "6000",
            "upgradePackages": "true"
        },
    },
    // Configure tool-specific properties.
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            // Set *default* container specific settings.json values on container create.
            "settings": {
                "python.defaultInterpreterPath": "/usr/local/bin/python",
                "terminal.integrated.defaultProfile.linux": "zsh"
            }
        }
    },
    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],
    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "pip3 install --user -r requirements.txt",
    // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    "remoteUser": "mmolisch"
}
Was this page helpful?