Skip to content

running in docker, result in 404 not found #651

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

Closed
ryanrain2016 opened this issue May 6, 2019 · 4 comments
Closed

running in docker, result in 404 not found #651

ryanrain2016 opened this issue May 6, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@ryanrain2016
Copy link

ryanrain2016 commented May 6, 2019

  • code-server version: docker: codercom/code-server:latest
  • OS Version: CentOS 7.5 in Kvm

Description

I run code-server in docker,but when visit it ,get 404 response.

Steps to Reproduce

I run docker command below:

docker run -it -d --network subnet --ip=172.19.0.200 -v "${PWD}:/home/coder/project" --name code-server codercom/code-server --allow-http --no-auth

and curl it:

curl http://172.19.0.200:8443/

get the response below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Not Found</pre>
</body>
</html>
[root@ryansite code-server]# curl http://172.19.0.200:8443/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Not Found</pre>
</body>
</html>

addition information

>>> docker logs code-server
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/home/coder/.local/share/code-server","extensions-dir":"/home/coder/.local/share/code-server/extensions","working-dir":"/home/coder/project","log-dir":"/home/coder/.cache/code-server/logs/20190506073825258"}
INFO  Starting shared process [1/5]...
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
WARN  Launched without authentication.
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO   
WARN  stderr {"data":"(node:19) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
Error: ENOENT: no such file or directory, open '/src/packages/server/build/web/index.html'
Error: ENOENT: no such file or directory, open '/src/packages/server/build/web/index.html'
INFO  Connected to shared process
>>> docker version
Client:
 Version:           18.09.5
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        e8ff056
 Built:             Thu Apr 11 04:43:34 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.5
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       e8ff056
  Built:            Thu Apr 11 04:13:40 2019
  OS/Arch:          linux/amd64
  Experimental:     false
@ryanrain2016 ryanrain2016 added the bug Something isn't working label May 6, 2019
@pyaillet
Copy link

pyaillet commented May 6, 2019

It works if I build from master. It seems to be a problem with version published on the docker hub (1.939 / latest)

@ryanrain2016
Copy link
Author

I find myself making a mistake. I checked the files there, It has a name index.html.gz,thus I should add 'Accept-Encoding: gzip, deflate' Header to curl, and that works.
If it is visited by browser, there's no problem.

@DaniilVysotskiy
Copy link

I have similar problem, but with a bit other error:
docker:

admin@120582:~$ sudo docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server --allow-http
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/home/coder/.local/share/code-server","extensions-dir":"/home/coder/.local/share/code-server/extensions","working-dir":"/home/coder/project","log-dir":"/home/coder/.cache/code-server/logs/20190602082845749"}
INFO  Starting shared process [1/5]...
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
INFO   
INFO  Password: f440fd2b68e805325f35be6f
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO   
WARN  stderr {"data":"(node:19) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Connected to shared process
Error: ENOENT: no such file or directory, open '/src/packages/server/build/web/code/index.html'

curl:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Not Found</pre>
</body>
</html>

Mentioned workaround didn't work for me. Any hints what should I be looking for?

@ryanrain2016
Copy link
Author

As I explained above, I think you should try this.

curl -H 'Accept-Encoding: gzip, deflate' http://url.to.your.server

@DaniilVysotskiy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants