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: Create workspace volume mount as current user instead of root #198

Closed
nphmuller opened this issue May 7, 2019 · 10 comments
Assignees
Labels
containers Issue in vscode-remote containers doc
Milestone

Comments

@nphmuller
Copy link

nphmuller commented May 7, 2019

  • VSCode Version: 1.34.0-insider
  • Local OS Version: Win 10 1903
  • Remote OS Version: Debian GNU/Linux 9 (stretch)
  • Remote Extension/Connection Type: Docker

Steps to Reproduce:

  1. Create dockerfile:
FROM node:lts
USER node
ENV HOME /home/node
  1. Run Open folder in Container...
  2. Open terminal to container in VSCode - The terminal should be logged in as node@containerid
  3. Run ls -l /workspaces in container.

Result: The workspace folder and its files have root:root permission
Expected: The workspace folder and its files should have node:node permission

Note:
This is not the same issue as #49
That issue described that new files are created with root:root permissions, while the container runs as root user. My issue describes that files are created as root:root, even when the container user is non-root (node in my example).

@egamma egamma added the containers Issue in vscode-remote containers label May 7, 2019
@nphmuller
Copy link
Author

nphmuller commented May 7, 2019

Take note that I can't simply chown from postCreateCommand because postCreateCommand runs as non-root (node) and the volume is already owned by root at that point.

@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label May 7, 2019
@nphmuller
Copy link
Author

I guess this is more of a Docker issue then a remote-containers issue.
Docker uses the userid and groupid of the host when bind mounting host data. If the ids don't exist in the container it falls back to root.

There are work arounds for this, for example this project: https://github.com/boxboat/fixuid
See this issue for more info (it's closed, but the discussion is still ongoing): moby/moby#7198.

Since I don't actually need this (my problem turned out the be the CIFS filesystem Docker uses when mounting Windows volumes), and this seems the wrong place for this issue, I'm going to close this.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 21, 2019
@microsoft microsoft unlocked this conversation Jun 28, 2019
@chrmarti
Copy link
Contributor

Reopening to track this issue.

@chrmarti chrmarti reopened this Jun 28, 2019
@chrmarti
Copy link
Contributor

This seems to work as expected in the latest (requires VS Code Insiders). Could you check if you still see it @nphmuller ?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Jun 28, 2019
@nphmuller
Copy link
Author

nphmuller commented Jun 28, 2019

I can still repro the bug in 1.36.0-insider via the steps in the initial post.
I'm on Windows. Maybe it works on Linux/Mac?

Version: 1.36.0-insider (user setup)
Commit: fe0c3e785c22c3ed2d5caa7178488c92d62bdb08
Date: 2019-06-28T12:34:35.956Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

@chrmarti
Copy link
Contributor

chrmarti commented Jul 1, 2019

You're right, it's Windows specific. I can create a file as user node and the file ends up showing root:root as ownership. Outside the container the file is owned by the current user.

That's all good except for root being shown as the owner inside the container. @Chuxel It might help documenting the quirks the mount points on the host filesystem have. This one for WIndows and #49 for Linux. Mac seems to do a proper mapping of user and group ownership.

@vscodebot vscodebot bot closed this as completed Jul 8, 2019
@vscodebot
Copy link

vscodebot bot commented Jul 8, 2019

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@nphmuller
Copy link
Author

@chrmarti I think the issue got closed because the ‘needs-more-info’ tag wasn’t removed. :)

@Chuxel Chuxel removed the info-needed Issue requires more information from poster label Jul 8, 2019
@Chuxel
Copy link
Member

Chuxel commented Jul 8, 2019

@nphmuller You are right - reactivating. 😊

@Chuxel Chuxel reopened this Jul 8, 2019
@Chuxel
Copy link
Member

Chuxel commented Jul 29, 2019

@nphmuller @chrmarti This has been updated in the docs. I'm closing since the broader feature that is needed for Linux hosts is tracked in #49 and to some extent #46 and #1050.

@Chuxel Chuxel closed this as completed Jul 29, 2019
@chrmarti chrmarti added doc containers Issue in vscode-remote containers and removed bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers labels Aug 26, 2019
@chrmarti chrmarti added this to the August 2019 milestone Aug 26, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers doc
Projects
None yet
Development

No branches or pull requests

4 participants