Plasm
Plasm

Reputation: 109

DNS issue between containers with Pi-hole using podman

I'm running a nextcloud container with podman-compose. There are 3 containers in the compose.yaml file: nextcloud, mariadb and redis. mariadb and redis are referenced by nextcloud by their name with these environment variables:

environment:
- MYSQL_HOST=mariadb
- REDIS_HOST=redis

Everything is normal until here, nextcloud is running fine. But when I then start a Pi-hole container, nextcloud isn't able to reach mariadb/redis anymore. The log says: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mariadb failed: Name or service not known. So it seems, that Pi-hole is taking over name resolution for the nextcloud container. Of course, the names mariadb and redis aren't set in Pi-hole, since podman is creating a seperate network for the containers and is responsible for domain name resolution inside this network.

Here are some additional infos:

Platform: Raspberry Pi 5
OS: Raspbberry Pi OS based on Debian 12 (bookworm)
podman: 4.3.1 (newest available Version on the OS)
podman-compose: 1.0.3 (newest available Version on the OS)
Nextcloud: 30.0.4 (newest)
Pi-hole: development-Tag (last pulled today)

So my question is: Am I doing something wrong? Maybe it's a bug in podman 4.3? I'm not able to find any information about that. Latest podman version is 5.3.1, but I gave up trying to compile it myself due to too many dependency problems.

Here are the compose.yaml files. I removed the secrets sections and smtp configuration since it's not related to this issue.

Nextcloud:

services:
  nextcloud:
    container_name: nextcloud
    image: docker.io/library/nextcloud:30.0.4
    ports:
      - "8080:80"
    volumes:
      - ./nextcloud:/var/www/html
    environment:
      - TZ=Europe/Berlin
      - MYSQL_HOST=mariadb
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=secret
      - REDIS_HOST=redis
      - REDIS_HOST_PASSWORD=anothersecret
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=evenmoresecret
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.home
      - PHP_UPLOAD_LIMIT=4G
      - APACHE_BODY_LIMIT=4294967296
    depends_on:
      mariadb:
        condition: service_completed_successfully
      redis:
        condition: service_completed_successfully

  mariadb:
    container_name: nextcloud_mariadb
    image: docker.io/library/mariadb:11.6.2
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - ./mariadb:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=secret
      - MYSQL_ROOT_PASSWORD=secretofcourse

  redis:
    container_name: nextcloud_redis
    image: docker.io/valkey/valkey:8.0.2
    environment:
      - REDIS_PASS=anothersecret
    command: bash -c 'redis-server --requirepass "$$(cat $$REDIS_PASS_FILE)"'

Pi-hole:

services:
  pihole:
    container_name: pihole-dev
    image: docker.io/pihole/pihole:development
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8001:80/tcp"
    volumes:
      - ./pihole:/etc/pihole
      - ./dnsmasq.d:/etc/dnsmasq.d
    environment:
      - WEBPASSWORD=secret
      - TZ=Europe/Berlin

Nextcloud is running fine with docker, even when Pi-hole is active, so I guess it's a podman issue (or at least a nextcloud/Pi-hole/podman compatibility issue). But I really want to use podman.

If I run Pi-hole under another user, Nextcloud is also running fine. But I then have to duplicate some infrastructure to different users (traefik, watchtower, ... - not running right now, but these are the next steps).

The DNS server is set up to:

Server1: 127.0.0.1 (Pi-hole)
Server2: Router-IP

The issue persists if I delete Server1 from the network config.

Upvotes: 0

Views: 62

Answers (0)

Related Questions