Let's say, you have a Rails app packed inside docker container. You also have a pg server installed directly on your virtual machine (well, just to save your money). This can be a problem, because on production you should allow only specific ips to have a connection to your database.
How you can do it then? This is a tutorial.
Read more