Currently docker-compose scale command creates random ports for the new containers.
Is there a way to specify a port for the new containers?
Currently docker-compose scale command creates random ports for the new containers.
Is there a way to specify a port for the new containers?
In your
docker-compose.yml
,it will bind to
5432
, however, note that you can't have more than one instance on the same node for obvious reason.To use multiple instances on one node you can use dynamic ports like this
Thus allowing the
scale=4
to create 4 instances published on5432
,5433
,5434
,5435
, but all routing to their internal ports.