Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote - Containers: NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/workspace/index.js' #6984

Closed
s-dehaan opened this issue Jul 22, 2022 · 6 comments
Labels
containers Issue in vscode-remote containers

Comments

@s-dehaan
Copy link

Hi,

I am running into the following error:

Unable to write file 'vscode-remote://dev-container+7b2...d7d/workspace/index.js' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/workspace/index.js')

The interesting thing is that I can edit and delete all the existing files. I just cannot create new ones.

I am using the official node docker image.
I am using the non-root user provided by the image.
I run docker-desktop as my unprivileged user account (systemctl --user start docker-desktop.service).
The user node is available in the image.
The UID and GID are synced correctly between my local user and the node user inside the container.

I have tried all the solutions in the other issues that resemble my problem but none has worked. I have the same error on two different linux machines, specs below.

System 1.

  • OS: Fedora 36 Linux x64 5.18.11-200.fc36.x86_64
  • Version of VS Code: 1.69.1
  • Remote-Containers: 0.241.3
  • Remote Extension/Connection Type: Docker-Desktop
  • Remote OS Version: Debian Bullseye, Alpine (Official Nodejs docker images)

System 2.

  • OS: Ubuntu 22.04 Linux x64 5.15.0-41-generic
  • Version of VS Code: 1.69.2
  • Remote-Containers: 0.241.3
  • Remote Extension/Connection Type: Docker-Desktop
  • Remote OS Version: Debian Bullseye, Alpine (Official Nodejs docker images)

Remote-Containers is the only extension installed.

Reproducible steps (1... 2... 3...) that cause the issue

  • Create a test folder.
  • Create the .devcontainer folder
  • Copy the devcontainer.json, docker-compose.yml and the Dockerfile to the .devcontainer folder.
  • Open the test folder in VS Code
  • Command Palette: Rebuild and Reopen in Container
  • When you try to create a new file in the workspace you get the error.

What you expected to see, versus what you actually saw

I would expect:

node@70562af9dd33:/workspace$ ls -la
total 12
drwxr-xr-x 3 node node 4096 Jul 22 21:30 .
drwxr-xr-x 1 root root 4096 Jul 22 21:28 ..
drwxr-xr-x 2 node node 4096 Jul 22 19:54 .devcontainer

But saw this:

ls -la output of my workspace when the container has started.

node@70562af9dd33:/workspace$ ls -la
total 12
drwxr-xr-x 3 root root 4096 Jul 22 21:30 .
drwxr-xr-x 1 root root 4096 Jul 22 21:28 ..
drwxr-xr-x 2 root root 4096 Jul 22 19:54 .devcontainer

Include your container configuration files if you are able to.

devcontainer.json

{
    "name": "Test",
    "dockerComposeFile": [
      "docker-compose.yml"
    ],
    "service": "app",
    "workspaceFolder": "/workspace",
    "forwardPorts": [8080],
    "remoteUser": "node",
    "extensions": [
    ]
  }

docker-compose.yml

 services:
  app:
    image: node:bullseye
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ..:/workspace
    expose:
      - "8080"
    ports:
      - "8080:8080"
    networks:
      - front-tier
    command: /bin/sh -c "while sleep 1000; do :; done"

networks:
  front-tier: {}

Dockerfile

FROM node:bullseye

USER node

Hope anyone can help me. Let me know if you need more information.

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Jul 22, 2022
@s-dehaan
Copy link
Author

s-dehaan commented Jul 23, 2022

One addition to this issue. When I run the devcontainer removing every reference to the node user. The container run as root and file creation works without problems.

devcontainer.json

{
    "name": "Test",
    "dockerComposeFile": [
      "docker-compose.yml"
    ],
    "service": "app",
    "workspaceFolder": "/workspace",
    "forwardPorts": [8080],
    // "remoteUser": "node",
    "extensions": [
    ]
  }

Dockerfile

FROM node:bullseye

However. I want to run as the node user.

@s-dehaan
Copy link
Author

I just did some more testing. The configuration works flawlessly when I use docker engine.

Perhaps the problem is related to docker-desktop being ran in user mode?

@jakobbouchard
Copy link

I am running into the exact same issue. Have you figured out how to fix the issue using docker-desktop?

The documentation says that "any mounted files/folders will have the exact same permissions as outside the container - including the owner user ID (UID) and group ID (GID)", but that doesn't seem to be the case as they are mounted as root.

@s-dehaan
Copy link
Author

I haven't tried it anymore after switching to docker engine.

@jakobbouchard
Copy link

yeah it's what i'm doing too, but it'd be great to be able to fix it nonetheless

@chrmarti
Copy link
Contributor

chrmarti commented Dec 7, 2022

Tracking rootless support as #4646. Thanks.

@chrmarti chrmarti closed this as completed Dec 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests

3 participants