Skip to content
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

Running NodeJS server in Docker Container #13

Closed
ahmad2smile opened this issue May 19, 2021 · 5 comments
Closed

Running NodeJS server in Docker Container #13

ahmad2smile opened this issue May 19, 2021 · 5 comments

Comments

@ahmad2smile
Copy link

typings not working when code is running inside a container. Is there any port I can expose to make it work or some config?

@rikukissa
Copy link
Owner

Try exposing the port 17341 to the docker container from the host where your VSCode is running

@ahmad2smile
Copy link
Author

Any idea how to do it? afaik, this can't be done unless typehole runtime calls host.docker.internal instead of localhost and docker container is created with network_mode: host, even which in my case can't be done as my container connects to a docker swarm networks so I can't replace those out.

@rikukissa
Copy link
Owner

rikukissa commented May 20, 2021

I just pushed a new release (1.6.0) of typehole both to npm and to VSCode. Now you are able to configure both the host address the runtime uses to connect to the extension server and the extension HTTP listener port. This is still undocumented, but you can configure the client like this

import typehole, { configure } from "typehole";

configure({
  extensionHost: 'http:https://host.docker.internal:17341'
});

What comes to your problem: do your docker containers have access to the public internet? One thing you could do is to expose the Typehole port to the outside internet for instance with ngrok.

$ ngrok http 17341

and then use the address you get in your runtime configuration

import typehole, { configure } from "typehole";

configure({
  extensionHost: 'https://b8722b82f530.eu.ngrok.io'
});

Could something like this work?

@rikukissa
Copy link
Owner

Closing the issue for now. Please feel free to reopen if you have issues connecting from your code to the extension after upgrading the extension and the runtime.

@ahmad2smile
Copy link
Author

I really appreciate your quick response and update. This is very useful, I'm still trying to make it work with my "work" project as there is where I need this the most.

The issues I'm facing are very particular to my own specific usecase. I can not use 3rd party servers at all for work, for that reason I'm looking to get typehole traffic out of container using some native solutions, for now ended up here:

docker/compose#3532

Same issue, to use overlay network and host network at the same time. If I were to find a solution, I'll update here for posterity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants