<div dir="ltr">The answer to this question is I was using the Docker default bridge network. My Postgres container was at 172.17.0.x. My Kea container was at 172.17.0.x+1. If I specify the host database IP in my kea.conf it worked, even though I presumed it would just think it was at localhost. The solution to my problem (given the Docker default bridge network allocates internal IPs via DHCP or something) is to use user-defined Docker networking and manually assign a specified IP to my Postgres container and use that IP in my Kea container's configuration.<div><br><br><div class="gmail_quote"><div dir="ltr">On Sat, 11 Nov 2017 at 20:56 Toby Walsh <<a href="mailto:walshtj@gmail.com">walshtj@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have set up a Postgres Docker container with kea user and kea database and all the schema applied (and some test host reservations) as per the documentation.<div><br></div><div>I have set up a Kea Docker container and I'm linking in the Postgres container, port 5432 and /var/run/postgresql and /var/lib/postgresql/data are volume mapped.</div><div><br></div><div>Within the Kea container I can start up psql with "psql -U kea -d kea -W" and see the full schema and my test entries.</div><div><br></div><div>From outside the container I can start it up with:</div><div><br></div><div>docker run --rm -it --link postgresdb -v /somedir/postgresql/data:/var/lib/postgresql/data -v /somedir/run/postgresql:/var/run/postgresql -p 5432 -it kea:1.3.0 psql -U kea -d kea -W</div><div><br></div><div>and it connects just fine and I can see everything applied. So I know the postgres database is readable from within the kea container and it thinks it's at localhost (per the linking).</div><div><br></div><div>Within the Kea container I cannot run kea-dhcp4. My kea.conf is fine. I tested that. It's the database connection. It fails with:</div><div><br></div><div>"2017-11-11 12:45:59.324 ERROR [kea-dhcp4.dhcp4/15] DHCP4_CONFIG_LOAD_FAIL configuration error using file: kea.conf, reason: Unable to open database: could not connect to server: Connection refused</div><div><span style="white-space:pre-wrap">   </span>Is the server running on host "localhost" (127.0.0.1) and accepting</div><div><span style="white-space:pre-wrap">    </span>TCP/IP connections on port 5432?</div><div>could not connect to server: Cannot assign requested address</div><div><span style="white-space:pre-wrap">      </span>Is the server running on host "localhost" (::1) and accepting</div><div><span style="white-space:pre-wrap">  </span>TCP/IP connections on port 5432?</div><div><br></div><div>2017-11-11 12:45:59.324 ERROR [kea-dhcp4.dhcp4/15] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file 'kea.conf': Unable to open database: could not connect to server: Connection refused</div><div><span style="white-space:pre-wrap">  </span>Is the server running on host "localhost" (127.0.0.1) and accepting</div><div><span style="white-space:pre-wrap">    </span>TCP/IP connections on port 5432?</div><div>could not connect to server: Cannot assign requested address</div><div><span style="white-space:pre-wrap">      </span>Is the server running on host "localhost" (::1) and accepting</div><div><span style="white-space:pre-wrap">  </span>TCP/IP connections on port 5432?"</div><div><br></div><div>This seems at odds with me being able to connect using psql. In my kea.conf I am specifying <span style="background-color:rgb(255,255,238);color:rgb(51,51,51);font-size:14px">"Dhcp4": { "hosts-database": { </span><strong class="m_-7749985012569293576inbox-inbox-userinput" style="color:rgb(51,51,51);font-size:14px"><code>"host" : ""</code></strong><span style="background-color:rgb(255,255,238);color:rgb(51,51,51);font-size:14px">, ... }, ... }</span> but I don't believe I should have to specify a host address. psql certainly doesn't think it's connecting remotely. Same problem from outside the container, with:</div><div><br></div><div>docker run /* all the same settings as for psql */ kea-dhcp4 -c kea.conf</div><div><br></div><div>Same errors. Has anyone encountered this scenario before? Anyone got any advice on how to proceed?</div><div><br></div><div>Thanks.</div></div></blockquote></div></div></div>