Localhost Tunnel Notes

long-tail guide · niche cluster

SSH Tunnel Connection Refused to Docker Port: Fix Checklist

“Connection refused” after an SSH tunnel usually means the forward is fine but nothing is listening on the far side address you named.

Checklist

  1. On the VPS: is the container up? docker ps
  2. Is the port published to loopback? Look for 127.0.0.1:3000->3000, not missing publish.
  3. Does curl -v http://127.0.0.1:3000 work on the VPS?
  4. Is your -L target exactly that host:port? Typo localhost vs wrong port is common.
  5. On the Mac: is something else already bound to the local port? Change -L 13000:127.0.0.1:3000.

Wrong mental model

SSH does not “open Docker to the world.” It only forwards to whatever is already listening on the VPS side.