beginnerDocker Networking: Bridge, Host, Overlay, DNS & Port Mapping
How would you isolate a database so only specific services can reach it?
Create a dedicated internal network (e.g., backend-net) and attach only the database and the services that legitimately need to talk to it. Public-facing services that should not have direct database access are simply never attached to that network, making the database unreachable from them at the network layer, independent of any application-level access controls.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response