I'm using docker-compose to deploy my app.
I want to access the deployment database from my development machine.
Is there a way to expose a port with a source IP address limit? Like what happens in advanced firewalls port forwarding.
I mean, I want to map my database port to something like 0.0.0.0:1234
, and only my IP can connect to that.
Currently, I exposed the ports to 127.0.0.1:1234
and used ssh port mapping to access that, but all running applications on that server and anyone who has ssh access to the server may connect to that.
db:
#....
ports:
- "127.0.0.1:1234:5432"
#....
ssh -L 1234:127.0.0.1:1234 [email protected]