At present we are publishing all our container ports when we want to have any container to container communication and then use host ip address as in:
// in app config:
default.host="{{repl HostPrivateIpAddress "db" "postgres" }}"
default.port="{{repl ConfigOption "db_external_port"}}"
This means that we expose our postgres port on host. This is a big security NO NO!.
I looked a lot through the docs and even your Native Scheduler Examples are using above patterns everywhere. At no point I see any example of using container-name or id for communication and not exposing the ports externally.
I believe only way to avoid exposing ports is to use a non-default, user-defined network that allows for inter container communication. Then we can resolve container names and access ports without exposing them on host interface.
Looks like you have a way to do just that:
https://help.replicated.com/docs/native/packaging-an-application/docker-options/#network
Unfortunately this is just for attaching container to specified network. it is not clear how I can create such network.
For example I was hoping that I can do something like:
// create my own network
networks:
my-net:
driver: bridge
...
// inside postgres container definition with no public_port
network: my-net // attach container to user-defined network (this looks already possible)
Thanks
sb_yb
@Yugabyte Inc.