Docker container restart fails

Using the 4.2.1 image, pi-hole starts successfully when the container is first created, but then if the container is restarted, pi-hole fails to start. To restart I need to re-create the container.

I'm using docker-compose to configure the container:

version: "3"
services:
  pihole:
    container_name: pihole
    image: pihole/pihole
    restart: always
    network_mode: host
    environment:
     - TZ=Pacific/Auckland
     - ServerIP=192.168.1.254
     - WEBPASSWORD=xxxx
     - DNS1=1.1.1.1
     - DNS2=1.0.0.1
    cap_add:
     - NET_ADMIN
    dns:
     - 127.0.0.1
     - 1.1.1.1

When I type "docker restart pihole" I get this in the log file (repeating over and over as the container continually tries to restart):

[fix-attrs.d] 01-resolver-resolv: applying...
[fix-attrs.d] 01-resolver-resolv: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 20-start.sh: executing...
stty: 'standard input': Inappropriate ioctl for device
 ::: Starting docker specific setup for docker pihole/pihole
OK: Checks passed for /etc/resolv.conf DNS servers
nameserver 127.0.0.1
nameserver 1.1.1.1
stty: 'standard input': Inappropriate ioctl for device
  [i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u1

  [i] Installing configs from /etc/.pihole...
  [i] Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
  [i] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf...^MESC[K  [✓] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf
chown: cannot access '/etc/pihole/dhcp.leases': No such file or directory
Setting password: xxxx
+ pihole -a -p xxxx xxxx
  [✓] New password set
Docker DNS variables not used
Existing DNS servers used
DNSMasq binding to default interface: eth0
grep: /etc/dnsmasq.d: Is a directory
sed: couldn't edit /etc/dnsmasq.d: not a regular file
[cont-init.d] 20-start.sh: exited 4.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.

Thanks for any suggestions!

This is a new problem with 4.2.1 - 4.1.1 worked correctly.

1 Like

I had the exact same problem and an update of the image solved it. (docker pull pihole/pihole:latest)

Yes that fixed it, thanks.