It is not possible, because each container has a own ip.
But there is a workaround:
Set network to host. So the ports are open on hostmaschine and are accessible via 127.0.0.1
. Not working on windows.
But I don't know any good reason why you like to use localhost
for postgres? Are you trying to authenticate via localhost
? Don't do that - use a password instead.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…