Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CANNOT USE HTTP-SERVER CREATED USING NODE WITH DOCKERIZED CODE-SERVER #2628

Answered by code-asher
nooobcoder asked this question in Q&A
Discussion options

I am creating this simple node app to host a http server. Currently I am using code-server dockerized version to do this, when running the script i cannot access the web-server outside from it. But when i am running the same script by ssh'ing to that location from my pc's terminal, the site is accessible. Need a way to access the server by running the script from code-server.

image
image
image

You must be logged in to vote
You probably need to expose port 1234 on the Docker side of things. You could also use code-server's built-in proxy to access the port by going to /proxy/1234.

Replies: 1 comment 3 replies

Comment options

You probably need to expose port 1234 on the Docker side of things. You could also use code-server's built-in proxy to access the port by going to /proxy/1234.
You must be logged in to vote
3 replies
Comment options

Can we have a detailed guide on using the built-in proxy of the code-server.
Seems like modifying the port on Docker's side, recreates the container and the user data and the extensions are lost.

Also, I suggest to integrate the settings sync feature as in VSCode. The settings sync feature is greatly missed in code-server.

Comment options

I was working on a ReactJS app and I was having issues in accessing the port. @code-asher your second suggestion of using the proxy somehow worked, the page loads but no content is loaded. I am attaching the screenshot, if you can suggest me a solution to this.
Please tell me a way by which the server can redirect the request to the desired directory to access the files. Seems like if i use proxy, the original files are not available when npm run start done.
image

The error code is this primarily: net::ERR_ABORTED 404 (Not Found)

Comment options

Here's our documentation on code-server's built-in proxy: https://github.com/cdr/code-server/blob/v3.8.0/doc/FAQ.md#how-do-i-securely-access-web-services (it's not a lot though).

Docker doesn't preserve the disk so if you want to persist files you'll need to mount the directories to your host system, for example with -v $HOME/.local/share/code-server /home/coder/.local/share/code-server. You might want to mount the config directory as well; see https://github.com/cdr/code-server/blob/v3.8.0/doc/install.md#docker

The issue for implementing settings sync is here: #2195

You might be running into this: #2222. We have a fix merged so hopefully we'll be able to put out a new code-server release soon. In the meantime exposing the port in Docker is your best bet I think.

Answer selected by nooobcoder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /