origamiofficial / docker-pihole-unbound

A supercharged Pi-Hole docker container with Unbound built-in. [Auto Updates 🚀]
https://hub.docker.com/r/rlabinc/pihole-unbound
MIT License
57 stars 5 forks source link

Unable to deploy in Docker swarm #22

Closed DreiPixel closed 9 months ago

DreiPixel commented 10 months ago

This is a: Run Issue

Details

I tried to run this Docker image on my Docker Swarm and it fails with this error message in the Logs:

Stopping lighttpd
s6-rc: info: service lighttpd successfully stopped
s6-rc: info: service pihole-FTL: stopping
Stopping pihole-FTL

  [✗] Unable to fill table adlist in database /etc/pihole/gravity.db

s6-rc: info: service pihole-FTL successfully stopped
s6-rc: info: service _startup: stopping
Terminated
s6-rc: info: service _startup successfully stopped
s6-rc: info: service _uid-gid-changer: stopping
s6-rc: info: service _uid-gid-changer successfully stopped
s6-rc: info: service cron: stopping
  [i] Cleaning up stray matter...Stopping cron
s6-rc: info: service cron successfully stopped
s6-rc: info: service legacy-cont-init: stopping
  [✓] Cleaning up stray matter
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

the Normal Pihole Docker image Runs fine. What is also noticed that the pihole folder i use gets the permission changed from the usual default i give it to 999:lxd which im pretty sure the normal image doesnt. also had it stuck hard on the unbound.sh once and the container wouldn't get killed.

Related Issues

How to reproduce the issue

  1. Environment data

    • Operating System: Ubuntu Server 22.04
    • Hardware: Turing RK1
    • Kernel Architecture: aarch64
    • Docker Install Info and version:
    • Software source: docker-ce
    • Supplimentary Software: portainer
    • Hardware architecture: aarch64
    • Docker Image Tag: latest
  2. docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here

    
    version: '3.8'

services: pihole: image: rlabinc/pihole-unbound:latest

ports:
  - "80:80/tcp"
  - "443:443/tcp"
  - target: 53
    published: 53
    protocol: tcp
    mode: host
  - target: 53
    published: 53
    protocol: udp
    mode: host
  - target: 67
    published: 67
    protocol: udp
    mode: host

environment:
  - TZ=${TIMEZONE}
  - WEBPASSWORD=${WEBPASSWORD}

volumes:
  - type: bind
    source: /mnt/docker-storage-ssd/pihole/pihole
    target: /etc/pihole
  - type: bind
    source: /mnt/docker-storage-ssd/pihole/dnsmasq.d
    target: /etc/dnsmasq.d

deploy:
  replicas: 1
  restart_policy:
    condition: on-failure
    max_attempts: 3


3. any additional info to help reproduce
the cluster is running with 4 nodes and all nodes have access to the same files via glusterfs.
and i know that this might be hard to debug. but since im only running this on one node this should be the same as running it on a normal system

## These common fixes didn't work for my issue
<!-- IMPORTANT! Help me help you! Ordered with most common fixes first. -->
- [X] I have tried removing/destroying my container, and re-creating a new container
- [X] I have tried fresh volume data by backing up and moving/removing the old volume data
- [ ] I have tried running the stock `docker run` example(s) in the readme (removing any customizations I added)
- [ ] I have tried a newer or older version of Docker Pi-hole (depending what version the issue started in for me)
- [X] I have tried running without my volume data mounts to eliminate volumes as the cause
- [X] I have tried running official Pi-hole docker image to check if it works there

If the above debugging / fixes revealed any new information note it here.
Add any other debugging steps you've taken or theories on root cause that may help.
origamiofficial commented 10 months ago

Is this a fresh installation?

Send me the unbound log file located at /opt/unbound/etc/unbound/unbound.log inside the container.

Also try this solution: https://github.com/origamiofficial/docker-pihole-unbound/issues/21#issuecomment-1913541536

DreiPixel commented 10 months ago

the log is completely empty. also tried the solution you suggested. when i try to restart it fails now at this "Unable to create new database /etc/pihole/gravity.db_temp"

origamiofficial commented 10 months ago

Tried fresh install without the volumes?

DreiPixel commented 10 months ago

it stopped compaining about unable to create new database but still wont start. Current docker compose file looks like this.

version: '3.8'

services:
  pihole:
    image: rlabinc/pihole-unbound:latest

    ports:
      - "80:80/tcp"
      - "443:443/tcp"
      - "192.168.3.203:53:53/tcp" 
      - "192.168.3.203:53:53/udp"
    environment:
      - TZ=${TIMEZONE}
      - WEBPASSWORD=${WEBPASSWORD}

      # This below is just Docker Swarm stuff
    deploy:
      replicas: 1
      placement:
        constraints: [node.labels.pihole == true ]
      restart_policy:
        condition: on-failure
        max_attempts: 3
origamiofficial commented 10 months ago

Share the docker log?

DreiPixel commented 10 months ago

_pihole-unbound_pihole.1.zdf27tczpcn3418nrce1w0lrd_logs.txt this is the complete log it gives me.

DreiPixel commented 10 months ago

uh i also tried with the exact same docker compose file the "old" image cbcrowe/pihole-unbound:latest. and that works fine but it uses a old pihole version.

origamiofficial commented 10 months ago

It seems something is wrong with the database. Can you run the container with your main compose file but without the Docker Swarm stuff and check if it works? If this issue is related to Docker Swarm then I'm afraid I can't help you out. Also, send me the FTL.log and FTL.log.1 from /var/log/pihole/ inside the container along with the complete docker log.

DreiPixel commented 10 months ago

ok i got it to work on certain conditions. New Containers will ALWAYS crash for me no matter what with or without the swarm stuff (and Docker swarm starts always starts new containers) if i try to start a existing container again with "docker compose up" when the container has already crashed once it will start fine. there is a pihole-1 | [1706568999] unbound[239:0] warning: unbound is already running as pid 259. line in the log when it has started fine.

with docker compose up --force-recreate it will always crash.

Edit: just Tested with with a Fresh Raspberry pi with DietPi installed. Same thing as above. New Containers will always Crash once. after the container is restarted it will run fine.

origamiofficial commented 9 months ago

As I can't recreate this issue on my end and you've found a fix, I'm closing this issue.

DreiPixel commented 9 months ago

As I can't recreate this issue on my end and you've found a fix, I'm closing this issue.

no i havent found a fix for docker swarm since containers are always recreated resulting in a crash no matter what. i just decided that i wont use this repo and used another that works fine.