docker-pihole-unbound icon indicating copy to clipboard operation
docker-pihole-unbound copied to clipboard

Error in docker-compose.yaml volumes

Open slochewie opened this issue 4 years ago • 6 comments

I can't remeber the error but the following fixed it. You have:
volumes: - etc_pihole-unbound:/etc/pihole:rw - etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw

Should be: volumes: - ./etc_pihole-unbound:/etc/pihole:rw - ./etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw Or: volumes: - $PWD/etc_pihole-unbound:/etc/pihole:rw - $PWD/etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw

or at least that's what got it to work for me.

Also Debian has a port conflict on 53. I have the fix listed at https://github.com/slochewie/docker-compose-files/tree/main/pihole-unbound under DEBIAN BASED DISTROS Feel free to copy it into your README or whatever. Once those steps are taken the port conflict goes away and the container starts properly.

slochewie avatar Jan 15 '21 09:01 slochewie

Thanks for this-- I haven't had the time to find a docker-compose volumes config that works for both docker-compose and for Portainer stacks. It's on my todo list.

chriscrowe avatar Jan 15 '21 16:01 chriscrowe

Thanks to you both; I am back up and "running" on debian. Any way to change the ports from 80 and 443 on pihole server? Ever since switching from the legacy (2 method) where I had a macvlan to this, it's running on my server, where other containers were previously using 443 and 80.

This method seems much slower than the old one, and it also seems to be adding .local to all of my DNS requests. Any suggestions?

Edit: Fixed - Removed conditional formatting in pihole DNS settings. I also had to change from local to 1 hop or no DNS resolves.

voc0der avatar Jan 17 '21 21:01 voc0der

This corrects the following error message: ERROR: Named volume "etc_pihole-unbound:/etc/pihole:rw" is used in service "pihole" but no declaration was found in the volumes section.

In case of an error search ;-)

mlopezcoria avatar Feb 03 '21 21:02 mlopezcoria

When I run the docker with docker-compose, with modified yaml config with "./" added : `- ./etc_pihole-unbound:/etc/pihole:rw

  • ./etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw` I get another error:

`ERROR: for ee1ab6f7eb0d_pihole Cannot start service pihole: b"Bind mount failed: '/volume1/docker/pihole-ubound/etc_pihole-unbound' does not exists"

ERROR: for pihole Cannot start service pihole: b"Bind mount failed: '/volume1/docker/pihole-ubound/etc_pihole-unbound' does not exists"`

Creating etc_pihole-unbound folder manually does not change the error.

AlixAbbasi avatar Feb 20 '21 11:02 AlixAbbasi

Tried both solutions in the startpost and get the error:

Deployment error In file '/data/compose/11/docker-compose.yml', volumes must be a mapping, not an array.

I did create the volumes before. Solution direction i can search?

Tried with and without created volumes in.

OS: Openmediavault Docker version: 20.10.8 portainer version: 2.6.3

Very new at this, so hope you can nudge me in the right direction to learn this.

Heronimos avatar Aug 30 '21 20:08 Heronimos

I use the following docker-compose.yml:

version: '2'

volumes:
  pihole:
  dnsmasq:
  unbound:

services:
  pihole:
    container_name: pihole-unbound
    image: cbcrowe/pihole-unbound:latest
    hostname: ${HOSTNAME}
    domainname: ${DOMAIN_NAME}
    ports:
      - ${WEB_PORT}:${WEB_PORT}/tcp
      - 53:53/tcp
      - 53:53/udp
#      - 80:80/tcp
      # - 5335:5335/tcp # Uncomment to enable unbound access on local server
      # - 22/tcp # Uncomment to enable SSH
    environment:
      ServerIP: ${ServerIP}
      TZ: ${TZ}
      WEBPASSWORD: ${WEBPASSWORD}
      WEB_PORT: ${WEB_PORT}
      REV_SERVER: ${REV_SERVER}
      REV_SERVER_TARGET: ${REV_SERVER_TARGET}
      REV_SERVER_DOMAIN: ${REV_SERVER_DOMAIN}
      REV_SERVER_CIDR: ${REV_SERVER_CIDR}
      DNS1: 127.0.0.1#5335 # Hardcoded to our Unbound server
      DNS2: 127.0.0.1#5335 # Hardcoded to our Unbound server
      DNSSEC: "true" # Enable DNSSEC
    volumes:
      - pihole:/etc/pihole:rw
      - dnsmasq:/etc/dnsmasq.d:rw
      - unbound:/etc/unbound:rw
    restart: unless-stopped

Add $WEB_PORT to you .env-file. I f.e. have it on 8100. And 80 and 443 are being used by nginx, so I had to comment those out.

The volumes being created are named:

drwx-----x 3 root root 4096 23 jan 10:58 pi-hole_pihole drwx-----x 3 root root 4096 23 jan 10:58 pi-hole_dnsmasq drwx-----x 3 root root 4096 23 jan 11:39 pi-hole_unbound

Although I don't know why it is pi-hole_ instead of pihole_ as the service is pihole. But I notice in Portainer also a stack called pi-hole. Dunno where that comes from, O, one minute later: it must be that my working directory is $HOME/pi-hole .

pluim003 avatar Jan 24 '22 10:01 pluim003