linuxserver / docker-code-server

GNU General Public License v3.0
1.54k stars 314 forks source link

Cannot run image built manually:No such file or directory #147

Closed SydneyOwl closed 1 year ago

SydneyOwl commented 1 year ago

Is there an existing issue for this?

Current Behavior

I built image via docker build --no-cache --pull -t lscr.io/linuxserver/code-server:latest . and started it by running

docker run -d \
  --name=code-server \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e PASSWORD=password `#optional` \
  -e HASHED_PASSWORD= `#optional` \
  -e SUDO_PASSWORD=password `#optional` \
  -e SUDO_PASSWORD_HASH= `#optional` \
  -e PROXY_DOMAIN=code-server.my.domain `#optional` \
  -e DEFAULT_WORKSPACE=/config/workspace `#optional` \
  -p 8443:8443 \
  -v /tmp:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/code-server:latest

on a windows platform, But it is not working as expected. In docker log it says,

2023-04-07 13:15:59 [migrations] started
2023-04-07 13:15:59 [migrations] no migrations found
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59   _____ __ __ _____ _____ _____ _____ 
2023-04-07 13:15:59  |     |  |  |   __|_   _|     |     |
2023-04-07 13:15:59  |   --|  |  |__   | | | |  |  | | | |
2023-04-07 13:15:59  |_____|_____|_____| |_| |_____|_|_|_|
2023-04-07 13:15:59        _____ __ __ _ __    ____  
2023-04-07 13:15:59       | __  |  |  | |  |  |    \ 
2023-04-07 13:15:59       | __ -|  |  | |  |__|  |  |
2023-04-07 13:15:59       |_____|_____|_|_____|____/ 
2023-04-07 13:15:59 
2023-04-07 13:15:59   Based on images from linuxserver.io
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
2023-04-07 13:15:59 To support LSIO projects visit:
2023-04-07 13:15:59 https://www.linuxserver.io/donate/
2023-04-07 13:15:59 
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 GID/UID
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
2023-04-07 13:15:59 User UID:    1000
2023-04-07 13:15:59 User GID:    1000
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
: No such file or directoryatal: unable to exec bash
2023-04-07 13:15:59 s6-rc: warning: unable to start service init-code-server: command exited 127

I've not tried building and running it in a linux environment so I am wondering if docker-code-server does not support windows platform so far?

Expected Behavior

Execute startup script properly.

Steps To Reproduce

  1. A windows platform.
  2. Build and run image as written in readme.

Environment

- OS: Windows 11
- How docker service was installed: Docker Desktop

CPU architecture

x86-64

Docker creation

docker run -d \
  --name=code-server \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e PASSWORD=password `#optional` \
  -e HASHED_PASSWORD= `#optional` \
  -e SUDO_PASSWORD=password `#optional` \
  -e SUDO_PASSWORD_HASH= `#optional` \
  -e PROXY_DOMAIN=code-server.my.domain `#optional` \
  -e DEFAULT_WORKSPACE=/config/workspace `#optional` \
  -p 8443:8443 \
  -v /tmp:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/code-server:latest

Container logs

2023-04-07 13:15:59 [migrations] started
2023-04-07 13:15:59 [migrations] no migrations found
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59   _____ __ __ _____ _____ _____ _____ 
2023-04-07 13:15:59  |     |  |  |   __|_   _|     |     |
2023-04-07 13:15:59  |   --|  |  |__   | | | |  |  | | | |
2023-04-07 13:15:59  |_____|_____|_____| |_| |_____|_|_|_|
2023-04-07 13:15:59        _____ __ __ _ __    ____  
2023-04-07 13:15:59       | __  |  |  | |  |  |    \ 
2023-04-07 13:15:59       | __ -|  |  | |  |__|  |  |
2023-04-07 13:15:59       |_____|_____|_|_____|____/ 
2023-04-07 13:15:59 
2023-04-07 13:15:59   Based on images from linuxserver.io
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
2023-04-07 13:15:59 To support LSIO projects visit:
2023-04-07 13:15:59 https://www.linuxserver.io/donate/
2023-04-07 13:15:59 
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 GID/UID
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
2023-04-07 13:15:59 User UID:    1000
2023-04-07 13:15:59 User GID:    1000
2023-04-07 13:15:59 ───────────────────────────────────────
2023-04-07 13:15:59 
: No such file or directoryatal: unable to exec bash
2023-04-07 13:15:59 s6-rc: warning: unable to start service init-code-server: command exited 127
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thespad commented 1 year ago

Are you modifying anything as part of the build and if so what?

We don't test on or support Windows, and it's certainly possible that it is affecting the build process.

aptalca commented 1 year ago

My money is on the executable bit getting lost during clone on Windows

SydneyOwl commented 1 year ago

I didn't modifying anything, just simply build and run the image. And seems it's not working after I manually added chmod -R 755 /etc/s6-overlay/s6-rc.d to dockerfile and build/run again like this: image ... Really weird. I also tried run init-code-server manually after entering the container: image it said no such file 'bash'. And I am wondering if this has something to do with the Shebang #!/usr/bin/with-contenv bash...Maybe s6-overlay is not compatible on windows platform? I noticed that the base image uses s6 to control processes. I tried modifying the original files so as to removing s6 and using debian as the baseimage just like this: https://github.com/sydneyowl/docker-code-server. And it works on my windows system.

aptalca commented 1 year ago

Let's take a step back. Why are you building instead of pulling?

SydneyOwl commented 1 year ago

I want to do some changes to the original dockerfile so I have to build it. And I just found that image pulled directly can run on windows: image And image build on wsl(ubuntu, amd64) via dockerfile is able to run: image image

aptalca commented 1 year ago

That all suggests something is getting messed up due to git clone on Windows filesystem.

You most likely don't have to edit the Dockerfile. We already publish a bunch of mods for it. And for other things, you can do custom scripts: https://www.linuxserver.io/blog/2019-09-14-customizing-our-containers

SydneyOwl commented 1 year ago

You're right. I use dos2unix to change all scripts in /etc to unix format and build again. This time it works, image image thanks!