Access to database broken after container restart

Hello, I am experiencing an issue with my pi-hole docker container. Every time I restart the container, I get the following error when trying to access Groups, Clients, Domains or Lists in the web interface. Also all of my settings under these menus disappear.

An unknown error occurred while loading the data.
{"error":{"key":"database_error","message":"Could not read domains from database table","hint":"Database not available"},"took":0.00013375282287597656}

If I rebuild the gravity using docker exec -it pihole pihole -g the error goes away, and I'm able to see everything fine. But restarting the container causes the error to come back.

Here are the contents of my docker-compose.yml file:

version: '3'
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
network_mode: "host" # Use host networking so Pi-hole gets the system IP
environment:
TZ: "America/Toronto" # Adjust for your timezone
WEBPASSWORD: ************* # Set a Pi-hole admin password
volumes:
- ./etc-pihole/:/etc/pihole/
- ./etc-dnsmasq.d/:/etc/dnsmasq.d/
cap_add:
- NET_ADMIN

What am I doing wrong??

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

docker exec -it <pihole-container-name-or-id> pihole -d

where you substitute <pihole-container-name-or-id> as required.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.