Home > Blockchain >  In a vscode development container, is there a way to access the docker container from a different ma
In a vscode development container, is there a way to access the docker container from a different ma

Time:01-01

I have an app (sveltekit) running inside and would like to access it from other devices on my local network.

I can access it normally from the host machine on localhost:3000.

I want to access it somehow from another machine on the local network. Is this possible? Sveltekit cli has --host flag, which outputs the following:

$ svelte-kit dev --host

local:   http://localhost:3000
network: http://172.17.0.3:3000

How do I access that network url from a different device on the local network?

OS: Pop OS
VSCode: 1.63.0 
Docker: Latest stable version.

Docker Installed using repository. Running in rootless mode.

CodePudding user response:

All that was needed was to change the following VSCode setting. By default it was set to "localhost". Setting it to "allInterfaces" grants access to other devices on the local network.

// settings.json

"remote.localPortHost": "allInterfaces"

Then, on another device connected to the same wifi network, use the following URL:

Format: <your-local-ip>:3000
Example: 192.168.1.105:3000

Note: In this scenario passing --host to the sveltekit cli is not required. VSCode seems to be handling that.

  • Related