mariomare22 / docker-pihole-unbound

Run Pi-Hole + Unbound + DoT on Docker
21 stars 8 forks source link

Cannot start service pihole: OCI runtime create failed: (Happening on Pi4) #17

Open wamak9 opened 1 year ago

wamak9 commented 1 year ago

I tried to run docker compose as root as well, same error. Any suggestions ?

Recreating 600544e175d7_pihole ... error

ERROR: for 600544e175d7_pihole  Cannot start service pihole: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:76: mounting "/home/wam/config/pihole/hosts" to rootfs at "/etc/hosts" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for pihole  Cannot start service pihole: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:76: mounting "/home/wam/config/pihole/hosts" to rootfs at "/etc/hosts" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
wamak9 commented 1 year ago

Tried below changes with running compose as sudo. Not luck yet.

      - /home/root/config/pihole/hosts:/etc/hosts:rw
      - /home/root/config/pihole/etc_pihole-unbound:/etc/pihole:rw
      - /home/root/config/pihole/etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw
      - /home/root/config/pihole/etc_unbound:/etc/unbound/unbound.conf.d/:rw
mariomare22 commented 1 year ago

Hello try to remove everything from the folder and create manually the file hosts touch hosts

wamak9 commented 1 year ago

let me give that a try. I will get back to you. Thanks

wamak9 commented 1 year ago

This is what I see now, which is little weird.

[1682743935] unbound[579:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743935] unbound[579:0] fatal error: could not open ports
Starting unbound
[1682743936] unbound[625:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743936] unbound[625:0] fatal error: could not open ports
  Pi-hole version is v5.16.2 (Latest: v5.16.2)
  FTL version is v5.22 (Latest: v5.22)
  Container tag is: 2023.03.1
Starting unbound
[1682743937] unbound[653:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743937] unbound[653:0] fatal error: could not open ports
Starting unbound
[1682743938] unbound[665:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743938] unbound[665:0] fatal error: could not open ports
Starting unbound
[1682743939] unbound[677:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743939] unbound[677:0] fatal error: could not open ports
Starting unbound
[1682743940] unbound[689:0] error: can't bind socket: Cannot assign requested address for ::1 port 53
[1682743940] unbound[689:0] fatal error: could not open ports
wamak9 commented 1 year ago

I am using portainer and i keep seeing this in logs. Are there any special config I need to do ?

mariomare22 commented 1 year ago

Which os are you running on what hardware?

Sent from Proton Mail for iOS

Il sab, apr 29, 2023 alle 07:10, Waseem @.***(mailto:Il sab, apr 29, 2023 alle 07:10, Waseem < ha scritto:

I am using portainer and i keep seeing this in logs. Are there any special config I need to do ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

wamak9 commented 1 year ago

I am running this on pi4.

mariomare22 commented 1 year ago

From docker pihole documentation


Installing on Ubuntu or Fedora

Modern releases of Ubuntu (17.10+) and Fedora (33+) include systemd-resolved which is configured by default to implement a caching DNS stub resolver. This will prevent pi-hole from listening on port 53. The stub resolver should be disabled with: sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf

This will not change the nameserver settings, which point to the stub resolver thus preventing DNS resolution. Change the /etc/resolv.conf symlink to point to /run/systemd/resolve/resolv.conf, which is automatically updated to follow the system's netplan: sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf' After making these changes, you should restart systemd-resolved using systemctl restart systemd-resolved
wamak9 commented 1 year ago

I tried but no luck. I also trying different approach running pihole and unbound as two different containers and that works without issues. Anyways, I wil try to dig deeper, if not I will go with later approach. I appreciate the help.

brianinmaine commented 1 year ago
 volumes:
      - /srv/pihole/etc_pihole-unbound:/etc/pihole:rw
      - /srv/pihole/etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw
      - /srv/pihole/etc_unbound:/etc/unbound/unbound.conf.d/:rw
      - type: bind
        source: /srv/pihole/hosts
        target: /etc/hosts
    #  - /srv/pihole/hosts:/etc/hosts:rw
    restart: unless-stopped

this worked for me so far...

mariomare22 commented 1 year ago

Try this

systemctl disable systemd-resolved.service
systemctl stop systemd-resolved
zenzip commented 1 year ago

Same issue here:

[1685691318] unbound[430:0] fatal error: could not open ports
Starting unbound
[1685691319] unbound[445:0] error: can't bind socket: Cannot assign requested address for ::1 port 53

I'm on Ubuntu server 23.04 VM, tried all the above suggestions, but didn't solve.

This is my compose file:


version: '3.0'

services:
  pihole:
    container_name: pihole
    image: ghcr.io/mariomare22/docker-pihole-unbound:latest
    hostname: ${HOSTNAME}
    domainname: ${DOMAIN_NAME}
    ports:
      - 53:53/tcp
      - 53:53/udp
      - ${PIHOLE_WEBPORT:-80}:80/tcp #Allows use of different port to access pihole web interface when other docker containers use port 80

    environment:
      - PUID=1000
      - PGID=1000
      - FTLCONF_LOCAL_IPV4=${FTLCONF_LOCAL_IPV4}
      - TZ=${TZ}
      - WEBPASSWORD=${WEBPASSWORD}
      - REV_SERVER=${REV_SERVER:-false}
      - REV_SERVER_TARGET=${REV_SERVER_TARGET}
      - REV_SERVER_DOMAIN=${REV_SERVER_DOMAIN}
      - REV_SERVER_CIDR=${REV_SERVER_CIDR}
      - PIHOLE_DNS_=127.0.0.1#5335
      - DNSSEC=${DNSSEC:-false}
      - DNSMASQ_LISTENING=single
    volumes:
      - /docker-data/pihole/etc_pihole:/etc/pihole:rw
      - /docker-data/pihole/dnsmasq:/etc/dnsmasq.d:rw
      - /docker-data/pihole/etc_unbound:/etc/unbound/unbound.conf.d/:rw
      - /docker-data/pihole/hosts:/etc/hosts:rw
    restart: unless-stopped
mariomare22 commented 7 months ago

Hey! issue seems related to Dockerfile -> COPY pihole-unbound/unbound-pihole.conf /etc/unbound/unbound.conf.d/pi-hole.conf GitHub Actions is not copying the file into the container. adding the file manually into the mounted volume works as workaround. looking for a solution.

mariomare22 commented 7 months ago

https://github.com/mariomare22/docker-pihole-unbound/commit/92e79c5a13ed3d0d9e0a1c885cd7532dc41ff575

issue looks resolved with this commit. @zenzip test latest image please and let me know!

zenzip commented 7 months ago

great thanks