

SSH tunnels let us do that without modifying our Docker configuration!įor the rest of this example I’ll refer to the two computers in this scenario as “the laptop” and “the desktop”, running the frontend and backend portions respectively, but keep in mind that you could do this with other setups as well. This allows you to work on the lighter parts of the application without experiencing slowdown (or fan noise, or other things like that) on your laptop.īecause the different parts of the application were already using Docker, it wasn’t hard to run the different pieces on separate machines, but they needed to know to talk to each other across the network. The solution is simple but effective: If you have another computer available - in my case, a desktop computer that I don’t usually use for work - you can run the performance-intensive containers on that machine. What if you only need to make modifications to the frontend or another light part of the application? I asked around and found that a couple of coworkers had already found a workaround. Applications like this can of course slow your computer down quite a bit. For instance, there’s a database container, a container for part of the backend that needs CUDA support, and several others, in addition to a React frontend.

One of our clients has an application with a lot of different moving parts that all need to communicate with each other for the entire application to function. There are many other uses for SSH tunnels.

Splitting a multi-container Docker app between multiple machines This is becoming more common as IPv4 addresses become more scarce.Īlso note that for more permanent situations, a VPN like WireGuard or OpenVPN might be a better choice than an SSH tunnel however, for lower-volume traffic SSH works just fine, and it is often quicker to set up. is the user and hostname of the remote server.Īnd that’s it! The reverse tunnel will now forward traffic from our publicly visible server to the specified port to our machine.Īnother good use for this setup is when you have an IPv4 address at the edge of a network but only IPv6 internally.

25565 is a TCP port number (UDP isn’t supported by SSH out of the box) and will vary based on the application you’re using. Note that 0.0.0.0 means to listen on all IP addresses, such as 127.0.0.1, your internal network NAT address, and any others. 0.0.0.0:25565 specifies which traffic to intercept on the remote host and localhost:25565 where to forward it to.
