Comments (21)
This is how I see we're teaching people bad practices. They don't know linux, and they're learning via guides. If they decide to use Linux outside of Coder they won't know the concept behind sudo
and permissions. We need to let them know "hey, you might need to run this specific command first before doing that", and this adds a certain familiarity of how the concept of permissions work.
We in turn, teach them how security usually works in Linux for beginners, and we give a sense of familiarity for other users. You don't see GCP giving you away a VM with a root account because you're expected to know about sudo
and the concept of Linux security by permissions.
from code-server.
I'm willing to reimplement the Dockerfile in the repo by basing off from my already existing image, should I get enough consensus that we should do usermode in this Dockerfile.
from code-server.
Docker best-practices (βUSERβ section) describes how to do this.
As a side effect, running code-server as root will result in that the newly created files become owned by root, so soon enough user will end up with a project that cannot be modified from their regular user. To solve the permission issues, it is recommended to create a regular user and remap host UID & GID
from code-server.
I think @sr229 summed it up pretty well. I personally don't see running every command as sudo in this environment as a bad thing, but it doesn't instill good security practices & habits when this is transferred to other places.
from code-server.
I agree with @sr229 the container should not be launching commands as sudo all the time.
from code-server.
@incizzle appreciate the input but could you elaborate on your reasoning why?
from code-server.
I think this ^^ is the best idea at the moment. May want to wait for a code owner to give their opinions.
from code-server.
The design issue here is, that you should not make any modifications to the docker container after it started up.
Being able to install some dev tools etc. in the VS Code terminal while using it is very bad practice, and as mentioned in #86, there should be a seperate container for each terminal, which has the project directory mounted into it, and also the container image of that individually spawned container should have the required build/dev tools for each language or project type.
That said, adding a USER
statement to the dockerfile would break the possibility to use the terminal for anything like package installation.
from code-server.
@PhilsLab I don't think it should be as locked down as you need to on #86. However, I did provide a variant that does exactly that which works for OpenShift Online, but its pain to compensate for common use cases.
from code-server.
@PhilsLab, In order to have a separate container for each dev environment, it would require a lot of recoding of the actual VS code online program. It sounds likes its gonna be very hard to implement but it is a cool idea.
from code-server.
Theia did support this kind of work (Remember Eclipse Che 7?), however, this would require substantial backend re-engineering which would increase the amount of difficulty per new VSCode release since it might not be interopable with each other
from code-server.
You could just mount the projects and data-dir into your docker container on each start. Then you start where you were in a completely new environment.
from code-server.
Implementing it as per #183.
from code-server.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
Avoid installing or using sudo as it has unpredictable TTY and signal-forwarding behavior that can cause problems. If you absolutely need functionality similar to sudo, such as initializing the daemon as root but running it as non-root), consider using βgosuβ.
This is interesting, though I'm not sure if its applicable to us or whether the advice is about RUN
commands or the entrypoint.
As a side effect, running code-server as root will result in that the newly created files become owned by root, so soon enough user will end up with a project that cannot be modified from their regular user. To solve the permission issues, it is recommended to create a regular user and remap host UID & GID
This is definitely a big issue. I think this alone is enough to justify the use of a user account. We definitely do not want all files written as root but instead whatever user the dev is using.
from code-server.
Btw guys, container per terminal is being tracked at #190
from code-server.
@nhooyr From what I have done with user-mode containers, this might increase the image size, but I might be wrong.
from code-server.
@nhooyr From what I have done with user-mode containers, this might increase the image size, but I might be wrong.
Thats fine. Though, as I mentioned earlier, this issue has not yet been discussed by the team and we're not sure of its direction. Please keep in mind your changes may not be accepted.
Also, since we're using ENTRYPOINT we can omit the CMD stage IMHO. We should be fixing this in the program-side.
Already fixed. See #188
from code-server.
Do not like to run with root even inside the container, I think it important to have a user (ex: coder
)
WIP in PR #192 by @sr229 (good job)
from code-server.
As an FYI: from what I've seen CentOS / Fedora based systems require Docker to be run as root.
https://www.projectatomic.io/blog/2015/08/why-we-dont-let-non-root-users-run-docker-in-centos-fedora-or-rhel/ -- is a good read
from code-server.
That is interesting but I believe orthogonal to our discussion. We're discussing whether the processes inside the container should run as root.
from code-server.
My bad, misunderstood.
from code-server.
Related Issues (20)
- [Bug]: Unexpected behavior in extension settings HOT 1
- How to make extension login persistent across devices? HOT 6
- Android: UserLAnd code-server docs causing error HOT 9
- Allow login with token similar to jupyter notebook server HOT 1
- Cannot use any plugin in code-server HOT 3
- Update Code to 1.88 HOT 2
- iPad can't use the terminal HOT 2
- Git | Source control extension always stuck on running or processing for too long blocking other tools HOT 4
- pylance can not work in code-server HOT 2
- Coder resets settings after some time HOT 4
- Java Pack Plugin does not detect JDK ? Broken HOT 1
- extension request HOT 2
- Jupyter ipynb file cannot work on iPad, but iphone displays properly. I have already configed https for code-server. HOT 3
- About sharing the same extension dir for different sytem platform HOT 1
- code server interactive window takes forever to load HOT 3
- 4.23.1 breaks within selfhosted coder instance HOT 4
- Add --base-path flag for use with absolute proxy
- vscode server existing recall is not working HOT 1
- Can't install remote extensions HOT 14
- Update Code to 1.89 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-server.