-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit 3df771f
authored
Check the logged user instead of $USER (#3330)
* Check the logged user instead of $USER
Given that `sudo usermod --login "$DOCKER_USER" coder` and `sudo groupmod -n "$DOCKER_USER" coder` modify the container's disk it'll persist across restarts, but environment variables will be reset to whatever state they had at the end of `Dockerfile`. In this case, `$USER` is set to `coder`, so this branch will always be true.
By checking with the output of `whoami`, which gets it's information from `/etc/passwd`, we make sure to get the real logged user and not the one defined by $USER.
We also move `USER="$DOCKER_USER"` out of the branch, since we always want this to happen at entry-point. If we don't do this assignment, $USER will contain `coder` upon restart.
* Update entrypoint.sh
Check `$DOCKER_USER` was defined before copying it to `$USER`.1 parent 014d746 commit 3df771f
1 file changed
+9
-8
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 | - | ||
9 | - | ||
10 | - | ||
11 | - | ||
12 | - | ||
13 | - | ||
14 | - | ||
8 | + | ||
15 | 9 |
| |
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | 16 |
| |
17 | - | ||
17 | + | ||
18 | + | ||
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
|
0 commit comments