Duncan
Duncan

Reputation: 41

Pi-hole docker Portainer Stack volume config

I need help with the correct config for my Pi-hole Docker/Portainer Stack...

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 80:80/tcp
    volumes:
      - ./etc-pihole:/opt/pihole/etc/pihole
      - ./etc-dnsmasq.d:/opt/pihole/etc/dnsmasq.d
  
volumes:
  ./etc-pihole:
  ./etc-dnsmasq.d:

I think my error is that I should be mapping the absolute path for the two volumes. Please can someone educate me on where the "./" would reference to inside the docker container?

Reference to where I got the Pi-hole docker compose from for stack config. https://hub.docker.com/r/pihole/pihole

Upvotes: 1

Views: 2644

Answers (1)

kdxcxs
kdxcxs

Reputation: 46

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 80:80/tcp
    volumes:
      - ./etc-pihole:/opt/pihole/etc/pihole
      - ./etc-dnsmasq.d:/opt/pihole/etc/dnsmasq.d

It's not necessary to make the volumes named volumes and listed under the top-level volumes key. But if you do want it that way, you could try this out:

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 80:80/tcp
    volumes:
      - etc-pihole:/opt/pihole/etc/pihole
      - etc-dnsmasq.d:/opt/pihole/etc/dnsmasq.d
  
volumes:
  - etc-pihole:
  - etc-dnsmasq.d:

Check the doc if I didn't get your point correctly or for more detailed explaination.

Upvotes: 3

Related Questions