Skip to content

Conversation

@mzarnowski
Copy link

Currently, there is no way to attach the Unbound Container to a Redis Database.
This change compiles the
The resulting image is marginally bigger: < 1%
image

Verification

Checkout code

cd /tmp
git clone https://github.com/mzarnowski/unbound-docker.git --branch=enable-redis-backend
cd unbound-docker/1.20.0/

Configure unbound

The unbound.conf includes two changes:

Enabled cachedb module:

module-config: "validator cachedb iterator"

Configured Redis connection

cachedb:
    backend: "redis"
    redis-server-host: 10.91.0.20

Start Containers

podman network create foo-net --subnet=10.91.0.0/24

podman run --detach --net=foo-net --name=foo-redis --ip=10.91.0.20 "docker.io/library/redis:7.4.1-alpine3.20" --save 60 1000 --loglevel warning --maxmemory 4mb --maxmemory-policy allkeys-lfu

podman run --detach --net=foo-net --name=foo-unbound -v /tmp/unbound-docker/1.20.0/unbound.conf:/opt/unbound/etc/unbound/unbound.conf:ro,z -p "5353:53/udp" -p "5353:53/tcp" -it localhost/unbound-redis

Observe that Unbound connects to Redis

podman logs foo-unbound

image

Observe that received DNS request is stored in Redis

dig +short wykop.pl @localhost -p 5353

image

podman exec -it foo-redis redis-cli keys '*'

image

Ovserve that after restart, Unbound consults Redis

podman restart foo-unbound
dig +short wykop.pl @localhost -p 5353
podman logs foo-unbound

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant