If inside the container, yes localhost is fine. But I don't know how else from host we can connect to container without using IP/port. And since docker will assign random IP address, my preference would always be to tell docker to assign specific IP.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That sounds like a good idea. But can't you connect to the database with
localhost
?The alternative to hardcoding the values for Postgres would be to use environment variables, of course.
If inside the container, yes localhost is fine. But I don't know how else from host we can connect to container without using IP/port. And since docker will assign random IP address, my preference would always be to tell docker to assign specific IP.