loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.42k stars 305 forks source link

Temporary permissions issues on launch (detected dubious ownership in repository) #1107

Open mjswensen opened 3 weeks ago

mjswensen commented 3 weeks ago

What happened?

For the first few minutes after a container starts, the owner of the repository folder is root. At seemingly random, it changes to the correct user (in my case: node for the official Node.js-based dev container by Microsoft).

Below are some commands run from within the container shortly after starting it up. No other commands were run between them. I've highlighted the permission change in yellow:

Screenshot 2024-06-03 at 4 09 28 PM

Here's the text version of the screenshot:

  1. git status results in fatal: detected dubious ownership in repository at ...
  2. ls -alF shows current working directory owned by root:root
  3. Another ls -alF, run perhaps 30-60 seconds after the previous, shows current working directory owned by node:node, as it should be
  4. Another run of git status results in no error. (Also the branch name shows in the bash prompt since the permissions are in a corrected state)

What did you expect to happen instead?

The permissions should be correct upon the launching of the editor connected to the container.

How can we reproduce the bug? (as minimally and precisely as possible)

devcontainer.json:

{
  "name": "...",
  "build": { "dockerfile": "./Dockerfile" },
  "customizations": {
    "vscode": {
      "extensions": [
        "angular.ng-template",
        "editorconfig.editorconfig",
        "esbenp.prettier-vscode"
      ]
    }
  },
  "features": {
    "ghcr.io/devcontainers/features/github-cli:1": {}
  }
}

Dockerfile:

FROM mcr.microsoft.com/devcontainers/javascript-node:20
...
  1. Set up a git repository with the above container configuration files.
  2. Launch the dev container using DevPod
  3. Observe the behavior outlined above

Local Environment:

DevPod Provider:

Anything else we need to know?

The IDE used for the container is VS Code for web.


Thank you for this awesome tool!