SSH tunnel

I manage a couple of docker containers on my own servers and I am pretty used to just creating ssh tunnels so that I can for example restrict database access to localhost and still access it from my local development machine.

Flyctl comes with an ssh command, but can I create an ssh tunnel binding a port on my local machine to a running container?

e.G. ssh -L 6379:127.0.0.1:6379 user@fly.io.instance

Would be pretty great for debugging if I were able to access the redis database for example from my development machine.

Another use case I could think of is connecting with a Database UI like MongoDB Compass to a MongoDB Instance that is running on fly.io and only listening on the private network.

The fly proxy 6379:6379 -a <app-name> command in our CLI will do this! It’s relatively new and not very documented, but it works great for this kind of setup.