Connecting to a service on a docker container through tailscale

if i have a service running on docker on a linux vps, how can i connect to it through the internal network that tailscale has created?

the docker container is port forwarding so the port should be exposed locally on that vps server. netstat seems to show that
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN off (0.00/0/0)

but when i use localhost or the tailscale ip for the vps i am getting “connection refused”
127.0.0.1:5000
vpsip:5000

anyone have experience with something like this? thanks

1 Like

I’m having this same issue.

You’re not running tailscale within the Docker container, you want tailscaled on the host to allow connection to 127.0.0.1:5000?

starting “tailscaled --tun=userspace-networking” might be one way to do so, in that it will allow connections to localhost port 5000. It has some other effects though, that it will no longer function like a regular Linux network device: Userspace networking mode (for containers) · Tailscale

you need to configure routes, and allow ip forwarding in the linux VPS server. Take a look to the documentation