You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot start stopped docker container, user 'coder' does not exist #2767
The initial run works perfectly. I then stop the container using ctrl+c. When I try to start the container again using docker start code-server the container stops immediately. Running docker logs code-server outputs:
[2021-02-25T14:46:34.514Z] info code-server 3.9.0 fc6d123da59a4e5a675ac8e080f66e032ba01a1b
[2021-02-25T14:46:34.516Z] info Using user-data-dir ~/.local/share/code-server
[2021-02-25T14:46:34.537Z] info Using config file ~/.config/code-server/config.yaml
[2021-02-25T14:46:34.538Z] info HTTP server listening on http://0.0.0.0:8080
[2021-02-25T14:46:34.538Z] info - Authentication is enabled
[2021-02-25T14:46:34.538Z] info - Using password from ~/.config/code-server/config.yaml
[2021-02-25T14:46:34.538Z] info - Not serving HTTPS
^Cusermod: user 'coder' does not exist
This issue seems to be related to #2267, but I am still getting the user error message.
Run the following command (my user is kdeyko, this is reflected in the docker-compose.yaml file above):
$ docker-compose up -d
# Similar output should appear:# Creating network "vscode_default" with the default driver# Creating vscode ... done
[Optional, since the bug reproduces even without it] Check that code-server opens in the browser:
Restart the container
$ docker restart vscode
Try opening code-server in browser or check docker logs.
Expected
Code-server should work in browser.
Actual
Code-server cannot be opened in browser.
Curl shows "Connection refused" error:
$ curl http://localhost:8444
curl: (7) Failed to connect to localhost port 8444: Connection refused
Container logs are full of usermod: user 'coder' does not exist messages:
$ docker logs vscode
[2021-04-15T21:08:54.806Z] debug parsed command line {"args":{"_":["."],"bind-addr":"0.0.0.0:8080"}}
[2021-04-15T21:08:54.813Z] info Wrote default config file to ~/.config/code-server/config.yaml
[2021-04-15T21:08:54.816Z] debug parsed command line {"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password"}}
[2021-04-15T21:08:54.823Z] debug parent:28 spawned inner process 46
[2021-04-15T21:08:55.045Z] trace parent:28 got message {"message":{"type":"handshake"}}
[2021-04-15T21:08:55.047Z] trace child:46 got message {"message":{"type":"handshake","args":{"_":["."],"bind-addr":"0.0.0.0:8080","auth":"password","password":"supersecretpassword","config":"/root/.config/code-server/config.yaml","user-data-dir":"/root/.local/share/code-server","extensions-dir":"/root/.local/share/code-server/extensions","log":"trace","verbose":true,"host":"0.0.0.0","port":8080,"proxy-domain":[],"usingEnvPassword":true,"usingEnvHashedPassword":false}}}
[2021-04-15T21:08:55.048Z] info code-server 3.9.3 fe2dc2deb08e378069891b622bb62ad1d261d1b1
[2021-04-15T21:08:55.048Z] info Using user-data-dir ~/.local/share/code-server
[2021-04-15T21:08:55.049Z] trace Using extensions-dir ~/.local/share/code-server/extensions
[2021-04-15T21:08:55.057Z] info Using config file ~/.config/code-server/config.yaml
[2021-04-15T21:08:55.057Z] info HTTP server listening on http://0.0.0.0:8080
[2021-04-15T21:08:55.057Z] info - Authentication is enabled
[2021-04-15T21:08:55.057Z] info - Using password from $PASSWORD
[2021-04-15T21:08:55.057Z] info - Not serving HTTPS
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
usermod: user 'coder' does not exist
Notes
This issue can be reproduced in VS Code: I don't think so
I guess what we really want to check in that if statement is that the current user (as returned by id -u -n) is different from $DOCKER_USER?
sudo usermod --login "$DOCKER_USER" coder and sudo groupmod -n "$DOCKER_USER" coder will persist across restarts because it's modifying the container's disk. USER="$DOCKER_USER" will not survive a reset because environment variables will have whatever they have at the last command of Dockerfile (with the exemption of ENTRYPOINT).
Activity
KaneLeung commentedon Feb 27, 2021
same problem
kdeyko commentedon Apr 14, 2021
Having the same issue on code-server v3.9.3.
Here is the extract from my compose file:
jsjoeio commentedon Apr 14, 2021
@kdeyko would be happy to look into this to help.
Is there any chance you could provide repro steps using this template?
kdeyko commentedon Apr 15, 2021
@jsjoeio thanks for your reply!
Would you like me to create a new bug report via this template, or keep it in scope of this issue?
jsjoeio commentedon Apr 15, 2021
Feel free to do it here (thank you for asking!).
kdeyko commentedon Apr 15, 2021
OS/Web Information
code-server --version: 3.9.3 (docker image)Steps to Reproduce
docker-compose.yamlfile with the following contents:kdeyko, this is reflected in thedocker-compose.yamlfile above):Expected
Code-server should work in browser.
Actual
Code-server cannot be opened in browser.

Curl shows "Connection refused" error:
Container logs are full of
usermod: user 'coder' does not existmessages:Notes
This issue can be reproduced in VS Code: I don't think so
jsjoeio commentedon Apr 15, 2021
This is super thorough and will be a great start for figuring out this issue. Thanks @kdeyko♥️
code-asher commentedon Apr 15, 2021
Must be:
https://github.com/cdr/code-server/blob/e9985bd658ac42c5bef38553b3e83fdb1e459be3/ci/release-image/entrypoint.sh#L8-L12
I guess
USERmust get set back tocoderwhen the container restarts?kdeyko commentedon Apr 15, 2021
Just in case: I hope I understand the terms “Local OS” and “Remote OS” correctly - for “Remote OS” I mean the one on which I run the docker container.
kdeyko commentedon Apr 15, 2021
Also I noticed that after step 4 (restarting) the container gets continuously restarted:
LoongWynn commentedon Apr 26, 2021
I found that if you do not specify users, you can successfully restart it.
You can run it with args written below until the bug is fixed.
kdeyko commentedon Apr 26, 2021
@HanyuuLu, thanks, it worked! Though I still needed to use
user: "0:0"in my compose file.videlanicolas commentedon May 9, 2021
I guess what we really want to check in that if statement is that the current user (as returned by
id -u -n) is different from$DOCKER_USER?sudo usermod --login "$DOCKER_USER" coderandsudo groupmod -n "$DOCKER_USER" coderwill persist across restarts because it's modifying the container's disk.USER="$DOCKER_USER"will not survive a reset because environment variables will have whatever they have at the last command ofDockerfile(with the exemption of ENTRYPOINT).Re-fix coder#2767