I have a simple web app running on a cloud Docker node with an Nginx container and a MySQL container, both connected to the webapp network. While the Nginx container has ports 80 and 443 exposed, the MySQL container doesn't have any ports exposed to the outside. I'm looking for ways to connect to MySQL from my local machine without exposing these ports. Is there a method to access the webapp network remotely from my local setup?
3 Answers
You might consider using the host network mode. This way, MySQL can bind directly to the local network, allowing you to connect without exposing ports. Check out the Docker documentation on host networking for more details.
Honestly, your setup is pretty good as it stands. Keeping MySQL accessible only within the Docker network is a safer approach. If you need to connect from your local machine, you can securely SSH into your server and use tunneling to access MySQL.
Another approach is to use SSH tunneling. If you can SSH into your server, you can create a secure tunnel to MySQL without opening any public ports. Just ensure your SSH access is well-secured, like disabling password logins and using key authentication.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads