I created a container in docker and it tries to access a host called pgmaster. On the machine where docker is installed I added the following host: 10.0.0.3 pgmaster
to /etc/hosts
. So much when I try to make an ssh works perfectly: ssh vini@pgmaster
. But when my container attempts to access the master pg:
psql: could not translate host name "pgmaster" to address: Name or service not known
Yes, my container is trying to access a postgresql in the pgmaster machine. So much so that this command works perfectly on the main machine: psql mydb -h pgmaster -p 5432
Is there a place in the containers that I should name the hosts?