I'm new to Docker and have been working on self-hosting some services. I've managed to make them accessible from outside my home network, but now I have a couple of services that I want to keep strictly accessible only from the host itself—not even from other devices on the same network. What should I do to achieve this isolation?
4 Answers
Another approach is to modify the Docker daemon settings to change the default binding IP from 0.0.0.0 to 127.0.0.1. This can help prevent any accidental exposure of your services to other devices on your network.
To limit access to your Docker containers so that only the host can reach them, bind your container's ports to 127.0.0.1 instead of using just any interface. By doing this, you ensure that the services are only available locally on the host machine.
I find that it's also a good idea to set up a custom Docker network for your containers. This way, they are isolated from one another, which helps prevent port collisions and allows for better management of services. Each stack of services should have its own network.
If you're working with HTTP/HTTPS services, consider using a reverse proxy that can act as a firewall. This will give you an extra layer of control over which services are accessible and how they can be reached.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures