[Kea-users] Kea/docker/postgres configuration help

Toby Walsh walshtj at gmail.com
Sun Nov 12 05:10:19 UTC 2017


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.


On Sat, 11 Nov 2017 at 20:56 Toby Walsh <walshtj at gmail.com> wrote:

> 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.
>
> 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.
>
> 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.
>
> From outside the container I can start it up with:
>
> 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
>
> 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).
>
> 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:
>
> "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
> Is the server running on host "localhost" (127.0.0.1) and accepting
> TCP/IP connections on port 5432?
> could not connect to server: Cannot assign requested address
> Is the server running on host "localhost" (::1) and accepting
> TCP/IP connections on port 5432?
>
> 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
> Is the server running on host "localhost" (127.0.0.1) and accepting
> TCP/IP connections on port 5432?
> could not connect to server: Cannot assign requested address
> Is the server running on host "localhost" (::1) and accepting
> TCP/IP connections on port 5432?"
>
> This seems at odds with me being able to connect using psql. In my
> kea.conf I am specifying "Dhcp4": { "hosts-database": { *"host" : ""*,
> ... }, ... } 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:
>
> docker run /* all the same settings as for psql */ kea-dhcp4 -c kea.conf
>
> Same errors. Has anyone encountered this scenario before? Anyone got any
> advice on how to proceed?
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20171112/2071a31e/attachment.htm>


More information about the Kea-users mailing list