Coder Social home page Coder Social logo

pi-hole / docker-pi-hole Goto Github PK

View Code? Open in Web Editor NEW
7.8K 102.0 1.1K 1.96 MB

Pi-hole in a docker container

Home Page: https://pi-hole.net

License: Other

Shell 60.40% Python 36.21% Dockerfile 3.39%
pi-hole docker-container dns web-app ad-blocker

docker-pi-hole's Introduction

Docker Pi-hole

Pi-hole

Upgrade Notes

  • Using Watchtower? See the Note on Watchtower at the bottom of this readme

  • As of 2023.01, if you have any modifications for lighttpd via an external.conf file, this file now needs to be mapped into /etc/lighttpd/conf-enabled/whateverfile.conf instead

  • Due to a known issue with Docker and libseccomp <2.5, you may run into issues running 2022.04 and later on host systems with an older version of libseccomp2 (Such as Debian/Raspbian buster or Ubuntu 20.04, and maybe CentOS 7).

    The first recommendation is to upgrade your host OS, which will include a more up to date (and fixed) version of libseccomp.

    If you absolutely cannot do this, some users have reported success in updating libseccomp2 via backports on debian, or similar via updates on Ubuntu. You can try this workaround at your own risk (Note, you may also find that you need the latest docker.io (more details here)

  • Some users have reported issues with using the --privileged flag on 2022.04 and above. TL;DR, don't use that mode, and be explicit with the permitted caps (if needed) instead

Quick Start

  1. Copy docker-compose.yml.example to docker-compose.yml and update as needed. See example below: Docker-compose example:
version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "80:80/tcp"
    environment:
      TZ: 'America/Chicago'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped
  1. Run docker compose up -d to build and start pi-hole (Syntax may be docker-compose on older systems)
  2. Use the Pi-hole web UI to change the DNS settings Interface listening behavior to "Listen on all interfaces, permit all origins", if using Docker's default bridge network setting. (This can also be achieved by setting the environment variable DNSMASQ_LISTENING to all)

Here is an equivalent docker run script.

Overview

A Docker project to make a lightweight x86 and ARM container with Pi-hole functionality.

  1. Install docker for your x86-64 system or ARMv7 system using those links. Docker-compose is also recommended.
  2. Use the above quick start example, customize if desired.
  3. Enjoy!

Build Status Docker Stars Docker Pulls

Running Pi-hole Docker

This container uses 2 popular ports, port 53 and port 80, so may conflict with existing applications ports. If you have no other services or docker containers using port 53/80 (if you do, keep reading below for a reverse proxy example), the minimum arguments required to run this container are in the script docker_run.sh

If you're using a Red Hat based distribution with an SELinux Enforcing policy add :z to line with volumes like so:

    -v "$(pwd)/etc-pihole:/etc/pihole:z" \
    -v "$(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d:z" \

Volumes are recommended for persisting data across container re-creations for updating images. The IP lookup variables may not work for everyone, please review their values and hard code IP and IPv6 if necessary.

You can customize where to store persistent data by setting the PIHOLE_BASE environment variable when invoking docker_run.sh (e.g. PIHOLE_BASE=/opt/pihole-storage ./docker_run.sh). If PIHOLE_BASE is not set, files are stored in your current directory when you invoke the script.

Automatic Ad List Updates - since the 3.0+ release, cron is baked into the container and will grab the newest versions of your lists and flush your logs. Set your TZ environment variable to make sure the midnight log rotation syncs up with your timezone's midnight.

Running DHCP from Docker Pi-Hole

There are multiple different ways to run DHCP from within your Docker Pi-hole container but it is slightly more advanced and one size does not fit all. DHCP and Docker's multiple network modes are covered in detail on our docs site: Docker DHCP and Network Modes

Environment Variables

There are other environment variables if you want to customize various things inside the docker container:

Recommended Variables

Variable Default Value Description
TZ UTC <Timezone> Set your timezone to make sure logs rotate at local midnight instead of at UTC midnight.
WEBPASSWORD random <Admin password> http://pi.hole/admin password. Run docker logs pihole | grep random to find your random pass.
FTLCONF_LOCAL_IPV4 unset <Host's IP> Set to your server's LAN IP, used by web block modes.

Optional Variables

Variable Default Value Description
PIHOLE_DNS_ 8.8.8.8;8.8.4.4 IPs delimited by ; Upstream DNS server(s) for Pi-hole to forward queries to, separated by a semicolon
(supports non-standard ports with #[port number]) e.g 127.0.0.1#5053;8.8.8.8;8.8.4.4
(supports Docker service names and links instead of IPs) e.g upstream0;upstream1 where upstream0 and upstream1 are the service names of or links to docker services
Note: The existence of this environment variable assumes this as the sole management of upstream DNS. Upstream DNS added via the web interface will be overwritten on container restart/recreation
DNSSEC false <"true"|"false"> Enable DNSSEC support
DNS_BOGUS_PRIV true <"true"|"false"> Never forward reverse lookups for private ranges
DNS_FQDN_REQUIRED true <"true"|"false"> Never forward non-FQDNs
REV_SERVER false <"true"|"false"> Enable DNS conditional forwarding for device name resolution
REV_SERVER_DOMAIN unset Network Domain If conditional forwarding is enabled, set the domain of the local network router
REV_SERVER_TARGET unset Router's IP If conditional forwarding is enabled, set the IP of the local network router
REV_SERVER_CIDR unset Reverse DNS If conditional forwarding is enabled, set the reverse DNS zone (e.g. 192.168.0.0/24)
DHCP_ACTIVE false <"true"|"false"> Enable DHCP server. Static DHCP leases can be configured with a custom /etc/dnsmasq.d/04-pihole-static-dhcp.conf
DHCP_START unset <Start IP> Start of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
DHCP_END unset <End IP> End of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
DHCP_ROUTER unset <Router's IP> Router (gateway) IP address sent by the DHCP server (mandatory if DHCP server is enabled).
DHCP_LEASETIME 24 <hours> DHCP lease time in hours.
PIHOLE_DOMAIN lan <domain> Domain name sent by the DHCP server.
DHCP_IPv6 false <"true"|"false"> Enable DHCP server IPv6 support (SLAAC + RA).
DHCP_rapid_commit false <"true"|"false"> Enable DHCPv4 rapid commit (fast address assignment).
VIRTUAL_HOST ${HOSTNAME} <Custom Hostname> What your web server 'virtual host' is, accessing admin through this Hostname/IP allows you to make changes to the whitelist / blacklists in addition to the default 'http://pi.hole/admin/' address
IPv6 true <"true"|"false"> For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false.
TEMPERATUREUNIT c <c|k|f> Set preferred temperature unit to c: Celsius, k: Kelvin, or f Fahrenheit units.
WEBUIBOXEDLAYOUT boxed <boxed|traditional> Use boxed layout (helpful when working on large screens)
QUERY_LOGGING true <"true"|"false"> Enable query logging or not.
WEBTHEME default-light <"default-dark"|"default-darker"|"default-light"|"default-auto"|"high-contrast"|"high-contrast-dark"|"lcars"> User interface theme to use.
WEBPASSWORD_FILE unset <Docker secret path> Set an Admin password using Docker secrets. If WEBPASSWORD is set, WEBPASSWORD_FILE is ignored. If WEBPASSWORD is empty, and WEBPASSWORD_FILE is set to a valid readable file path, then WEBPASSWORD will be set to the contents of WEBPASSWORD_FILE.

Advanced Variables

Variable Default Value Description
INTERFACE unset <NIC> The default works fine with our basic example docker run commands. If you're trying to use DHCP with --net host mode then you may have to customize this or DNSMASQ_LISTENING.
DNSMASQ_LISTENING unset <local|all|single> local listens on all local subnets, all permits listening on internet origin subnets in addition to local, single listens only on the interface specified.
WEB_PORT unset <PORT> This will break the 'webpage blocked' functionality of Pi-hole however it may help advanced setups like those running synology or --net=host docker argument. This guide explains how to restore webpage blocked functionality using a linux router DNAT rule: Alternative Synology installation method
WEB_BIND_ADDR unset <IP> Lighttpd's bind address. If left unset lighttpd will bind to every interface, except when running in host networking mode where it will use FTLCONF_LOCAL_IPV4 instead.
SKIPGRAVITYONBOOT unset <unset|1> Use this option to skip updating the Gravity Database when booting up the container. By default this environment variable is not set so the Gravity Database will be updated when the container starts up. Setting this environment variable to 1 (or anything) will cause the Gravity Database to not be updated when container starts up.
CORS_HOSTS unset <FQDNs delimited by ,> List of domains/subdomains on which CORS is allowed. Wildcards are not supported. Eg: CORS_HOSTS: domain.com,home.domain.com,www.domain.com.
CUSTOM_CACHE_SIZE 10000 Number Set the cache size for dnsmasq. Useful for increasing the default cache size or to set it to 0. Note that when DNSSEC is "true", then this setting is ignored.
FTL_CMD no-daemon no-daemon -- <dnsmasq option> Customize the options with which dnsmasq gets started. e.g. no-daemon -- --dns-forward-max 300 to increase max. number of concurrent dns queries on high load setups.
FTLCONF_[SETTING] unset As per documentation Customize pihole-FTL.conf with settings described in the FTLDNS Configuration page. For example, to customize LOCAL_IPV4, ensure you have the FTLCONF_LOCAL_IPV4 environment variable set.

Experimental Variables

Variable Default Value Description
DNSMASQ_USER unset <pihole|root> Allows changing the user that FTLDNS runs as. Default: pihole, some systems such as Synology NAS may require you to change this to root (See #963)
PIHOLE_UID 999 Number Overrides image's default pihole user id to match a host user id
IMPORTANT: id must not already be in use inside the container!
PIHOLE_GID 999 Number Overrides image's default pihole group id to match a host group id
IMPORTANT: id must not already be in use inside the container!
WEB_UID 33 Number Overrides image's default www-data user id to match a host user id
IMPORTANT: id must not already be in use inside the container! (Make sure it is different to PIHOLE_UID if you are using that, also)
WEB_GID 33 Number Overrides image's default www-data group id to match a host group id
IMPORTANT: id must not already be in use inside the container! (Make sure it is different to PIHOLE_GID if you are using that, also)
WEBLOGS_STDOUT 0 0|1 0 logs to defined files, 1 redirect access and error logs to stdout

Deprecated environment variables:

While these may still work, they are likely to be removed in a future version. Where applicable, alternative variable names are indicated. Please review the table above for usage of the alternative variables

Docker Environment Var. Description Replaced By
CONDITIONAL_FORWARDING Enable DNS conditional forwarding for device name resolution REV_SERVER
CONDITIONAL_FORWARDING_IP If conditional forwarding is enabled, set the IP of the local network router REV_SERVER_TARGET
CONDITIONAL_FORWARDING_DOMAIN If conditional forwarding is enabled, set the domain of the local network router REV_SERVER_DOMAIN
CONDITIONAL_FORWARDING_REVERSE If conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. 0.168.192.in-addr.arpa) REV_SERVER_CIDR
DNS1 Primary upstream DNS provider, default is google DNS PIHOLE_DNS_
DNS2 Secondary upstream DNS provider, default is google DNS, no if only one DNS should used PIHOLE_DNS_
ServerIP Set to your server's LAN IP, used by web block modes and lighttpd bind address FTLCONF_LOCAL_IPV4
ServerIPv6 If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fully FTLCONF_LOCAL_IPV6
FTLCONF_REPLY_ADDR4 Set to your server's LAN IP, used by web block modes and lighttpd bind address FTLCONF_LOCAL_IPV4
FTLCONF_REPLY_ADDR6 If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fully FTLCONF_LOCAL_IPV6

To use these env vars in docker run format style them like: -e DNS1=1.1.1.1

Here is a rundown of other arguments for your docker-compose / docker run.

Docker Arguments Description
-p <port>:<port> Recommended Ports to expose (53, 80, 67), the bare minimum ports required for Pi-holes HTTP and DNS services
--restart=unless-stopped
Recommended
Automatically (re)start your Pi-hole on boot or in the event of a crash
-v $(pwd)/etc-pihole:/etc/pihole
Recommended
Volumes for your Pi-hole configs help persist changes across docker image updates
-v $(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d
Recommended
Volumes for your dnsmasq configs help persist changes across docker image updates
--net=host
Optional
Alternative to -p <port>:<port> arguments (Cannot be used at same time as -p) if you don't run any other web application. DHCP runs best with --net=host, otherwise your router must support dhcp-relay settings.
--cap-add=NET_ADMIN
Recommended
Commonly added capability for DHCP, see Note on Capabilities below for other capabilities.
--dns=127.0.0.1
Optional
Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, may fix resolution errors on container restart.
--dns=1.1.1.1
Optional
Sets a backup server of your choosing in case DNSMasq has problems starting
--env-file .env
Optional
File to store environment variables for docker replacing -e key=value settings. Here for convenience

Tips and Tricks

  • A good way to test things are working right is by loading this page: http://pi.hole/admin/
  • How do I set or reset the Web interface Password?
    • docker exec -it pihole_container_name pihole -a -p - then enter your password into the prompt
  • Port conflicts? Stop your server's existing DNS / Web services.
    • Don't forget to stop your services from auto-starting again after you reboot
    • Ubuntu users see below for more detailed information
  • You can map other ports to Pi-hole port 80 using docker's port forwarding like this -p 8080:80 if you are using the default blocking mode. If you are using the legacy IP blocking mode, you should not remap this port.
    • Here is an example of running with nginxproxy/nginx-proxy (an nginx auto-configuring docker reverse proxy for docker) on my port 80 with Pi-hole on another port. Pi-hole needs to be DEFAULT_HOST env in nginxproxy/nginx-proxy and you need to set the matching VIRTUAL_HOST for the Pi-hole's container. Please read nginxproxy/nginx-proxy readme for more info if you have trouble.
  • Docker's default network mode bridge isolates the container from the host's network. This is a more secure setting, but requires setting the Pi-hole DNS option for Interface listening behavior to "Listen on all interfaces, permit all origins".

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

Once pi-hole is installed, you'll want to configure your clients to use it (see here). If you used the symlink above, your docker host will either use whatever is served by DHCP, or whatever static setting you've configured. If you want to explicitly set your docker host's nameservers you can edit the netplan(s) found at /etc/netplan, then run sudo netplan apply. Example netplan:

network:
    ethernets:
        ens160:
            dhcp4: true
            dhcp4-overrides:
                use-dns: false
            nameservers:
                addresses: [127.0.0.1]
    version: 2

Note that it is also possible to disable systemd-resolved entirely. However, this can cause problems with name resolution in vpns (see bug report). It also disables the functionality of netplan since systemd-resolved is used as the default renderer (see man netplan). If you choose to disable the service, you will need to manually set the nameservers, for example by creating a new /etc/resolv.conf.

Users of older Ubuntu releases (circa 17.04) will need to disable dnsmasq.

Installing on Dokku

@Rikj000 has produced a guide to assist users installing Pi-hole on Dokku

Docker tags and versioning

The primary docker tags are explained in the following table. Click here to see the full list of tags. See GitHub Release notes to see the specific version of Pi-hole Core, Web, and FTL included in the release.

The Date-based (including incremented "Patch" versions) do not relate to any kind of semantic version number, rather a date is used to differentiate between the new version and the old version, nothing more. Release notes will always contain full details of changes in the container, including changes to core Pi-hole components

tag description
latest Always latest release
2022.04.0 Date-based release
2022.04.1 Second release in a given month
dev Similar to latest, but for the development branch (pushed occasionally)
*beta Early beta releases of upcoming versions - here be dragons
nightly Like dev but pushed every night and pulls from the latest development branches of the core Pi-hole components (Pi-hole, web, FTL)

Upgrading, Persistence, and Customizations

The standard Pi-hole customization abilities apply to this docker, but with docker twists such as using docker volume mounts to map host stored file configurations over the container defaults. However, mounting these configuration files as read-only should be avoided. Volumes are also important to persist the configuration in case you have removed the Pi-hole container which is a typical docker upgrade pattern.

Upgrading / Reconfiguring

Do not attempt to upgrade (pihole -up) or reconfigure (pihole -r). New images will be released for upgrades, upgrading by replacing your old container with a fresh upgraded image is the 'docker way'. Long-living docker containers are not the docker way since they aim to be portable and reproducible, why not re-create them often! Just to prove you can.

  1. Read the release notes for both this Docker release and the Pi-hole release
    • This will help you avoid common problems due to any known issues with upgrading or newly required arguments or variables
    • We will try to put common break/fixes at the top of this readme too
  2. Download the latest version of the image: docker pull pihole/pihole
  3. Throw away your container: docker rm -f pihole
    • Warning When removing your pihole container you may be stuck without DNS until step 3; docker pull before docker rm -f to avoid DNS interruption OR always have a fallback DNS server configured in DHCP to avoid this problem altogether.
    • If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
  4. Start your container with the newer base image: docker run <args> pihole/pihole (<args> being your preferred run volumes and env vars)

Why is this style of upgrading good? A couple reasons: Everyone is starting from the same base image which has been tested to known it works. No worrying about upgrading from A to B, B to C, or A to C is required when rolling out updates, it reduces complexity, and simply allows a 'fresh start' every time while preserving customizations with volumes. Basically I'm encouraging phoenix server principles for your containers.

To reconfigure Pi-hole you'll either need to use an existing container environment variables or if there is no a variable for what you need, use the web UI or CLI commands.

Pi-hole features

Here are some relevant wiki pages from Pi-hole's documentation. The web interface or command line tools can be used to implement changes to pihole.

We install all pihole utilities so the the built in pihole commands will work via docker exec <container> <command> like so:

  • docker exec pihole_container_name pihole updateGravity
  • docker exec pihole_container_name pihole -w spclient.wg.spotify.com
  • docker exec pihole_container_name pihole -wild example.com

Customizations

The webserver and DNS service inside the container can be customized if necessary. Any configuration files you volume mount into /etc/dnsmasq.d/ will be loaded by dnsmasq when the container starts or restarts or if you need to modify the Pi-hole config it is located at /etc/dnsmasq.d/01-pihole.conf. The docker start scripts runs a config test prior to starting so it will tell you about any errors in the docker log.

Similarly for the webserver you can customize configs in /etc/lighttpd

Systemd init script

As long as your docker system service auto starts on boot and you run your container with --restart=unless-stopped your container should always start on boot and restart on crashes. If you prefer to have your docker container run as a systemd service instead, add the file pihole.service to "/etc/systemd/system"; customize whatever your container name is and remove --restart=unless-stopped from your docker run. Then after you have initially created the docker container using the docker run command above, you can control it with "systemctl start pihole" or "systemctl stop pihole" (instead of docker start/docker stop). You can also enable it to auto-start on boot with "systemctl enable pihole" (as opposed to --restart=unless-stopped and making sure docker service auto-starts on boot).

NOTE: After initial run you may need to manually stop the docker container with "docker stop pihole" before the systemctl can start controlling the container.

Note on Capabilities

DNSMasq / FTLDNS expects to have the following capabilities available:

  • CAP_NET_BIND_SERVICE: Allows FTLDNS binding to TCP/UDP sockets below 1024 (specifically DNS service on port 53)
  • CAP_NET_RAW: use raw and packet sockets (needed for handling DHCPv6 requests, and verifying that an IP is not in use before leasing it)
  • CAP_NET_ADMIN: modify routing tables and other network-related operations (in particular inserting an entry in the neighbor table to answer DHCP requests using unicast packets)
  • CAP_SYS_NICE: FTL sets itself as an important process to get some more processing time if the latter is running low
  • CAP_CHOWN: we need to be able to change ownership of log files and databases in case FTL is started as a different user than pihole

This image automatically grants those capabilities, if available, to the FTLDNS process, even when run as non-root.
By default, docker does not include the NET_ADMIN capability for non-privileged containers, and it is recommended to explicitly add it to the container using --cap-add=NET_ADMIN.
However, if DHCP and IPv6 Router Advertisements are not in use, it should be safe to skip it. For the most paranoid, it should even be possible to explicitly drop the NET_RAW capability to prevent FTLDNS from automatically gaining it.

Note on Watchtower

We have noticed that a lot of people use Watchtower to keep their Pi-hole containers up to date. For the same reason we don't provide an auto-update feature on a bare metal install, you should not have a system automatically update your Pi-hole container. Especially unattended. As much as we try to ensure nothing will go wrong, sometimes things do go wrong - and you need to set aside time to manually pull and update to the version of the container you wish to run. The upgrade process should be along the lines of:

  • Important: Read the release notes. Sometimes you will need to make changes other than just updating the image
  • Pull the new image
  • Stop and remove the running Pi-hole container
    • If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
  • Recreate the container using the new image

Pi-hole is an integral part of your network, don't let it fall over because of an unattended update in the middle of the night.

User Feedback

Please report issues on the GitHub project when you suspect something docker related. Pi-hole or general docker questions are best answered on our user forums.

docker-pi-hole's People

Contributors

adyanth avatar alexandreratte avatar alexiswilke avatar athrogatepeq avatar cclauss avatar damajor avatar dependabot[bot] avatar diginc avatar distractionrectangle avatar dl6er avatar dschaper avatar edgd1er avatar frozendragoon avatar halkeye avatar lightswitch05 avatar mabunixda avatar mattkenn4545 avatar middleagedman avatar n6g7 avatar nazarkosteckij avatar nxadm avatar oscarnyl avatar peterdavehello avatar promofaux avatar rdwebdesign avatar shaderecker avatar static-void-main avatar vhp avatar williamtrelawny avatar yubiuser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-pi-hole's Issues

Inconsistent Behavior with Whitelist from Admin GUI

Using "debian_dev" tagged version, in the admin interface I'm noticing odd behavior:
Add a domain to whitelist
Confirm domain is added to end of /etc/pihole/whitelist.txt on container
Remove domain from whitelist via red garbage can icon on the right
Domain is removed from list in the GUI
Domain is no longer in whitelist.txt
However, domain is added to end of gravity.list (?!), causing the domain to be "pi-holed"

I noticed this in earlier versions as well.

Set up arm automated build

Docker hub is x86 only. The end solution will probably be a 3rd party building the images on arm hardware and pushing to a non-automated repository on docker hub.

I could setup a local build on my 2 pis and automated it my own own infrastructure but I'd like to avoid that. Partly to avoid maintenance long term and partly to publish the build logs through a 3rd party service in the spirit of open source.

Related #2 #28 #30

Setup split container POC

Split out DNS / Web services into individual containers that use volumes+links to share info.

The new experimental Docker application bundle should convert a docker-compose.yml which sould allow for running of a bundle of linked containers without compose in the future. Right now in docker 1.12 RC2 DAB it was not supporting the additional capability NET_ADMIN feature we use.

New v1.13 info discovered. Seems docker-engine in docker swarm mode (docker swarm init) also doesn't support NET_ADMIN even when running the containers through docker-compose, on a single swarm host.

image is not available?

docker run -p 53:53/tcp -p 53:53/udp -p 80:80 --cap-add=NET_ADMIN -e piholeIP="$IP" --name pihole -d dockerhole_alpine
Unable to find image 'dockerhole_alpine:latest' locally
Pulling repository docker.io/library/dockerhole_alpine
docker: Error: image library/dockerhole_alpine not found.
See 'docker run --help'.

Alpine / Nginx Version 403 Forbidden Error

In the Alpine / Nginx version, instead of the default landing page (blank html) I get a 403 Forbidden error. It will come up fine if I run 'cp /var/www/html/pihole/index.html /var/www/html/' inside the container.

Pi-Hole fails after host restart

I am running the latest build for arm (diginc/pi-hole:arm) and when restarting the host Pi-Hole fails to come back up. I have to login to the host, trash the container and start a new one.

From the logs it looks to be an issue around:

Added ENV to php:
            "VIRTUAL_HOST" => "pihole.lan",
            "ServerIP" => "192.168.1.10",

When it fails the VIRTUAL_HOST and ServerIP appear twice. So I think they are getting set a second time when the container restarts.

I create my container with the following:

docker run --restart=always -p 53:53/tcp -p 53:53/udp -p 8053:80 --cap-add=NET_ADMIN -e ServerIP="192.168.1.10" -e VIRTUAL_HOST="pihole.lan" --name pihole -v /var/log/pihole.log:/var/log/pihole.log -v /media/data/pihole/:/etc/pihole/ -d diginc/pi-hole:arm

Let me know if I can help debug further.

Add documentation on enabling login capability

First off awesome build and documentation! I can finally repurpose my RPi and use my Arch Linux server for DNS.

FYI.. You may want to add to your document that you can enable the cool login page by running:

docker exec pihole_container_name sudo pihole -a -p <password>

Then your users won't be able to muck with your configuration if they do go to the pi.hole web page.

Try on actual pi hardware

At some point I'd like to spike swapping out the base FROM x86 images with ARM versions and building/running with hyperiot. A little googling revealed both debian(raspian) and alpine have arm images available.

no internet access

hi

I think I got the docker running.. however in the webadmin interface the graphics aren't loading.

this is pihole on a VM I'm running:

serverinstall

and this is webadmin Docker image.

docker

as you can see not running properly..

this is the "details":

[ { "Id": "5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579", "Created": "2016-03-26T16:10:31.816740894Z", "Path": "tini", "Args": [ "--", "/bin/sh", "-c", "/start.sh" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 52239, "ExitCode": 0, "Error": "", "StartedAt": "2016-03-26T16:10:32.173696045Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:53ad0218709ccfea1c774232432480372234dd231e7220bc6effe2a3bd15d48d", "ResolvConfPath": "/var/lib/docker/containers/5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579/resolv.conf", "HostnamePath": "/var/lib/docker/containers/5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579/hostname", "HostsPath": "/var/lib/docker/containers/5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579/hosts", "LogPath": "/var/lib/docker/containers/5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579/5ab45a7d23842a6bc114ec617eff54291cb83548cae9e922404048b57281b579-json.log", "Name": "/Pihole", "RestartCount": 0, "Driver": "aufs", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/etc/localtime:/etc/localtime:ro", "/var/log/pihole.log:/var/log/pihole.log", "/etc/pihole/whitelist.txt:/etc/pihole/whitelist.txt", "/etc/pihole/blacklist.txt:/etc/pihole/blacklist.txt" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "bridge", "PortBindings": { "53/tcp": [ { "HostIp": "192.168.1.123", "HostPort": "53" } ], "53/udp": [ { "HostIp": "192.168.1.123", "HostPort": "53" } ], "80/tcp": [ { "HostIp": "192.168.1.123", "HostPort": "8053" } ] }, "RestartPolicy": { "Name": "always", "MaximumRetryCount": 0 }, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "ShmSize": 67108864, "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "KernelMemory": 0, "Memory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null }, "GraphDriver": { "Name": "aufs", "Data": null }, "Mounts": [ { "Source": "/var/log/pihole.log", "Destination": "/var/log/pihole.log", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Source": "/etc/pihole/whitelist.txt", "Destination": "/etc/pihole/whitelist.txt", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Source": "/etc/pihole/blacklist.txt", "Destination": "/etc/pihole/blacklist.txt", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Source": "/etc/localtime", "Destination": "/etc/localtime", "Mode": "ro", "RW": false, "Propagation": "rprivate" } ], "Config": { "Hostname": "pihole", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "53/tcp": {}, "53/udp": {}, "80/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh", "-c", "/start.sh" ], "Image": "diginc/pi-hole:latest", "Volumes": null, "WorkingDir": "", "Entrypoint": [ "tini", "--" ], "OnBuild": null, "Labels": {}, "StopSignal": "SIGTERM" }, "NetworkSettings": { "Bridge": "", "SandboxID": "d94056c04420fad07df10f47a328234f2db431ec6b06765263d6ebcd9325fd25", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "53/tcp": [ { "HostIp": "192.168.1.123", "HostPort": "53" } ], "53/udp": [ { "HostIp": "192.168.1.123", "HostPort": "53" } ], "80/tcp": [ { "HostIp": "192.168.1.123", "HostPort": "8053" } ] }, "SandboxKey": "/var/run/docker/netns/d94056c04420", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "4d4d4329506cd654e2ac8528362b2663f13dedc5720989e662a7c6eb9061c055", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "ad53359efd98fd5b96b3eab9fef7689ab20905f8cc4b735c319237ce985c29a0", "EndpointID": "4d4d4329506cd654e2ac8528362b2663f13dedc5720989e662a7c6eb9061c055", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } } } ]

Latest Alpine Build: Admin Interface Not Loading

Since rebuilding from the latest 'alpine', I get this error when trying to pull up admin page:
Failed Host Check: lvicpdnsp01.ingramcontent.com vs 10.10.46.39, , pi.hole, localhost, 10.10.46.39
(10.10.46.39 being our container's internal IP)

Why cap-add NET_ADMIN ?

Hi,
I wondered why pi-hole needs the NET_ADMIN capabilities? DHCP?
I'v started the container without the cap-add and it seems to work fine.

Confirm IPV6 Blocking

From docker hub comments:

yan1000, a month ago
hi, it doesn't block ipv6 address ads ? didn't add ipv6 support ? thx

Similar to the first bug I had with this container for IPv4, without the Docker Host's IP the pihole will find and return the internal docker IPv6 IP for ads, so it never hits the blank lighttpd assets.

I think a ServerIPv6 environment variable, similar to ServerIP env var, should fix this problem.
#39 and #40 also related

Error can't read /etc/pihole/setupVars.conf when mounting etc to volume

After the 2.11.1 update with #84 I tried to run the container as follows:

docker run -v $(pwd)/etc/:/etc/pihole/ -e ServerIP=127.0.0.1 diginc/pi-hole:debian

Since it is the first time, $(pwd)/etc/ is empty and I get the following output

+ export IMAGE
+ export ServerIP
+ export ServerIPv6
+ export PYTEST
+ export PHP_ENV_CONFIG
+ export PHP_ERROR_LOG
+ export HOSTNAME
+ export WEBLOGDIR
+ export DNS1
+ export DNS2
+ export IPv6
+ . /bash_functions.sh
++ . /opt/pihole/webpage.sh
+++ setupVars=/etc/pihole/setupVars.conf
+++ dnsmasqconfig=/etc/dnsmasq.d/01-pihole.conf
+++ dhcpconfig=/etc/dnsmasq.d/02-pihole-dhcp.conf
+ echo ' ::: Starting docker specific setup for docker diginc/pi-hole'
+ validate_env
+ '[' -z 127.0.0.1 ']'
+ change_setting IPV4_ADDRESS 127.0.0.1
+ delete_setting IPV4_ADDRESS
+ sed -i /IPV4_ADDRESS/d /etc/pihole/setupVars.conf
 ::: Starting docker specific setup for docker diginc/pi-hole
sed: can't read /etc/pihole/setupVars.conf: No such file or directory

Workaround is to touch etc/setupVars.conf prior to running the container for the first time.

This is probably due to the changed made for the pi-hole password support. See: #84 (comment)

Same is true for diginc/pi-hole:alpine

Replace `pihole -up` with suggestion to docker pull / rm / up instead

docker exec pihole pihole -up fails per: pi-hole/web#150 (comment)

fatal: Not a git repository (or any of the parent directories): .git
/usr/local/bin/pihole: line 59: /etc/.pihole/automated install/basic-install.sh: No such file or directory

Why is it broken?

Since I do not add any of the git repositories data like the official pihole install, the update method they use is broken. This keeps my container size lower and docker users have the docker pull + docker rm + docker up container upgrade path. docker rm shouldn't remove any important data if you setup volume maps for your critical data.

What to do?

I'm thinking of stubbing that functionality with a echo'd suggestion to throw your old container away and pull the latest version, then re-create the container using the latest base image.

Why refuse to just make pihole -up just work?

I suppose I could support the rolling update method and let people do this if they really wanted to but I'd at least want to warn them that they are going down an unsupported path and the first thing I'd tell them is to destroy their container and re-create it if they hit any strange behavior. If they did and suddenly had an old version I'd know they hadn't pulled the latest version.

The docker way is to stay in-line with what latest version is on the docker hub/cloud so we're all Identical and not snowflakes. By updating locally you're forking at a old point in time and could run into bugs that would be unique to you since everyone else is updating from a common base image off hub, which has consistent tested behavior.

0 Domains Being Blocked

I've just updated my docker container to the latest from docker hub, but now the admin UI says that no domains are blocked. I ran an updateGravity and this is what I got...

$ docker exec pihole pihole updateGravity
:::
::: Neutrino emissions detected...
:::
::: No custom adlist file detected, reading from default file... done!
:::
::: Getting raw.githubusercontent.com list... No changes detected, transport skipped!
::: Getting mirror1.malwaredomains.com list... No changes detected, transport skipped!
::: Getting sysctl.org list... No changes detected, transport skipped!
::: Getting zeustracker.abuse.ch list... No changes detected, transport skipped!
::: Getting s3.amazonaws.com list... No changes detected, transport skipped!
::: Getting s3.amazonaws.com list... No changes detected, transport skipped!
::: Getting hosts-file.net list... No changes detected, transport skipped!
::: Getting raw.githubusercontent.com list... No changes detected, transport skipped!
:::
::: Aggregating list of domains...cat: can't open '/etc/pihole/list.0.raw.githubusercontent.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.1.mirror1.malwaredomains.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.2.sysctl.org.domains': No such file or directory
cat: can't open '/etc/pihole/list.3.zeustracker.abuse.ch.domains': No such file or directory
cat: can't open '/etc/pihole/list.4.s3.amazonaws.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.5.s3.amazonaws.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.6.hosts-file.net.domains': No such file or directory
cat: can't open '/etc/pihole/list.7.raw.githubusercontent.com.domains': No such file or directory
 done!
::: Formatting list of domains to remove comments.... done!
::: 0 domains being pulled in by gravity...
::: Removing duplicate domains.... done!
::: 0 unique domains trapped in the event horizon.
:::
::: Adding adlist sources to the whitelist... done!
::: Whitelisting 6 domains... done!
::: Nothing to blacklist!
::: Formatting domains into a HOSTS file...
:::
::: Cleaning up un-needed files... done!
:::
::: Refresh lists in dnsmasq...
::: Pi-hole blocking is Enabled

Time Sync

It would be nice to allow for syncing of the time inside of the docker container with that of the host. Either through NTP or at least setting of the timezone.

Running cron job inside the container?

Just digging around the set up of the container and was curious why the docker-pi-hole.cron jobs couldn't be run from within the container itself? If there's no technical reason this won't work/isn't desired, would you be open to a PR adding this functionality?

only 2 domains being blocked

After the issue I reported yesterday, and you fixed rather quickly. I wanted to use the new container version. So i did the standard procedure (pull, stop, rm, run). After this I saw in the admin interface that only 2 domains were being blocked. So I tried updating the blocklist with the following command:

docker exec pihole pihole updateGravity

I got the following output:

::: Aggregating list of domains...cat: can't open '/etc/pihole/list.0.raw.githubusercontent.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.1.mirror1.malwaredomains.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.2.sysctl.org.domains': No such file or directory
cat: can't open '/etc/pihole/list.3.zeustracker.abuse.ch.domains': No such file or directory
cat: can't open '/etc/pihole/list.4.s3.amazonaws.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.5.s3.amazonaws.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.6.hosts-file.net.domains': No such file or directory
cat: can't open '/etc/pihole/list.7.raw.githubusercontent.com.domains': No such file or directory
cat: can't open '/etc/pihole/list.8.ransomwaretracker.abuse.ch.domains': No such file or directory
done!

I guess the no such file errors are the reason only 2 domains are blocked

Confirm ipv6 functionality

more details, when I first made the container I wasn't sure if v6 was working but I've since seen lots of logs with ipv6 addresses and such. Now that I have testing setup I'd like some automated tests for this so I'll leave it open.

workaround for docker NAT with udp issue

I just installed the container on my Pi. I am using it together with an OpenVPN container, my goal was to connect to the VPN with my phone, and use pi-hole for blocking ads. It didn't work at first, although I had dnsmasq running in a container before, which worked fine: host names were not resolved when using the eth0 address of the Pi as the DNS server, but did work when I used the docker interface address of the pi-hole container. It took me some time until I remembered this issue (which I solved already for the old dnsmasq container, but forgot): moby/moby#11998 . The workaround is to specify the IP address for the -p options, eg:

docker run --rm -p 192.168.0.2:53:53/tcp -p 192.168.0.2:53:53/udp -p 192.168.0.2:80:80 --cap-add=NET_ADMIN -e ServerIP=192.168.0.2 --name pihole diginc/pi-hole:arm

It may only be necessary for the udp port (I could use port 80 before the workaround).

This is probably worth noting in the instructions.

lighttpd errors

Using any of the recent Debian versions (tags debian, debian_dev, debian_pi-2.7.1_admin-dev), docker logs shows this:

dnsmasq: syntax check OK.
2016-07-15 16:04:11: (configfile.c.957) source: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf line: 23 pos: 16 parser failed somehow near here: [
2016-07-15 16:04:11: (configfile.c.957) source: /usr/share/lighttpd/include-conf-enabled.pl line: 3 pos: 1 parser failed somehow near here: (EOL)
2016-07-15 16:04:11: (configfile.c.957) source: /etc/lighttpd/lighttpd.conf line: 48 pos: 1 parser failed somehow near here: (EOL)

It works fine if I revert back to "debian_pi-2.7_admin-1.3". But of course that version doesn't support blacklist/whitelist updating from the admin page, and shows the 'update' banner.

Readme Updates

Need some post-#84 accuracy and improvements to the README.md / documentation and linked scripts. Thoughts so far:

  • Review this statement for accuracy: "Upgrading If you try to use pi-hole -up it will fail." since .git folder data is present now.
    • needs updates to any similar statements to strongly suggest the 'docker way' of upgrading, or at least to start from scratch if you have any issues around upgrading.
  • A docker hub comment suggested adding --restart=always to the docker run command. ๐Ÿ‘
    • Should add to the scripts / docker-compose files too
  • #86 could fall under this umbrella

Feel free to add any suggestions.

Include LDAP Module for Ngnix

I'd like to restrict access to the Admin page, using LDAP (AD) rather than local passwords. Would you consider adding "nginx-auth-ldap"?

Thanks,
Daniel

Custom Config /etc/dnsmasq.d

*Great Job !! *

But I still having issue with customizing : /etc/dnsmasq.d/01-pihole.conf
even i'm using -v /srv/etc/dnsmasq.d:/etc/dnsmasq.d or /srv/etc/dnsmasq.d:/etc/dnsmasq.d:ro
something replace my :
addn-hosts=/etc/pihole/mylist.list by addn-hosts=/etc/pihole/gravity.list

Even by making the change into 01-pihole.conf before docker build .
The result is the same.

Strangely others modification on that file still after a reboot.

I also tried by making a 02-mylist.conf and when i'm doing that it simply don't start.

:(

Multiple Server IP's or DDNS Support

If you give the SERVER_IP variable a DDNS address you receive the following error on loading:

Failed Host Check: domain.duckdns.org vs 192.168.1.X, , , pi.hole, localhost, 192.168.1.X

Any way to add support for this?

Request? redirect ad addresses to hostname?

Sorry for this obtuse feature request, let me elaborate.

I am running this image inside docker on my Synology NAS. It it working great (many thanks) however, the IP address that is returned for ads to be blocked is the IP of my Synology, therefore showing the Synology response from port 80.

I am able to reverse proxy the Synology NAS port 80 to the docker container running pi-hole however this is hostname based.

My request (maybe this should be to the authors of pi-hole?) is that instead of returning the value of ServerIP environment variable to pull ads from it would be great if I could re-direct them to a different hostname which would be the name used in the reverse proxy to get the data from pi-hole container.

I hope this makes some sense?

BUG: There is a new version of Pi Hole but he doesn't update.

Thanks for your nice Docker image!

Pi hole did have a update a couple days ago but I can't update my docker. When I run the docker image it doesn't get the newest version of Pi hole. On the repository It gives also that it uses a older version of the master branche 'AdminLTE @ 3e6955d'.

Could you update the Docker?

Thanks!

Use Alpine for ARM instead of Debian

Hi,

I was wondering about the possibility of using an ARM port of Alpine instead of Debian for the arm tag. I've been playing with this in the last hours mostly for fun, but also because tini won't load on a RPi 1 (but will start just fine on a RPi 2). I think it might be related to their build: it might require at least an ARMv7, and the RPi 1 is an ARMv6. I didn't really went that far on checking it, all I saw is that tini wasn't starting on my RPi 1 with a segfault.

Anyway, just for the sake of it, I've trying using one of the ARM ports available for Alpine, hypriot/rpi-alpine. Since Alpine has its own tini build, the image wouldn't have to rely on downloading it externally. I've patched the necessary parts of the Dockerfile and started a container and it seems to work just fine. I didn't do an extensive test though.

The only small issue I've found so far is that PHP was built without IPv6 support, so that gives a warning in the admin console. Other than that, everything seems to be functional.

Anyway, my question is if you guys have thought about using an ARM port of Alpine instead of Debian for ARM (of even having support for both), or if maybe you're interested in this patch? :)

Cheers!

As of 2.13.1 new DNS error

Hi, This container has been working great, after updating to the latest I receive the following error that doesnt allow the container to start:

dnsmasq: missing parameter at line 42 of /etc/dnsmasq.d/01-pihole.conf

More specifically:
mounting \"/var/log/pihole.log\" to rootfs \"/var/lib/docker/btrfs/subvolumes/90c579ffeef24643f4814ce7a36c54a32cd17dfd0c39026ffa29f848a1aa2d33\" at \"/var/lib/docker/btrfs/subvolumes/90c579ffeef24643f4814ce7a36c54a32cd17dfd0c39026ffa29f848a1aa2d33/var/log/pihole.log\" caused \"not a directory\"""

I have always had the same path mapping here (the default) for the log file.

Any ideas?

DNS1 and DNS2 environment variables do not work as documented

The documentation suggests that these variables set the upstream DNS server to use for resolving. Except after starting my image with these variables I get the following in /etc/dnsmasq.d/01-pihole.conf

server=8.8.8.8 server=8.8.4.4
I would expect the values of the environment variables.

Error after reboot

Hi,

At the first execution, no problem.

If we stop the docker container, it put me the following error:
image

Failed Host Check: pihole vs xxx

Hi,

I've deployed the pihole container on my home server. When I try to access /admin, I get this error:
Failed Host Check: pihole vs 192.168.5.201, , , pi.hole, localhost, 192.168.5.201

Maybe this is due to my "unusual" setup. I already had a reverse proxy in place so I am not using jwilder/proxy. I have the following in my nginx container (which is bound to 80:80) - nginx.conf

    server {
        listen 80;
        server_name myserver;
        location /confluence {
            proxy_set_header X-Forwarded-Host $host:$server_port;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://confluence:8090/confluence;
            client_max_body_size 500M;
        }

        location / {
            proxy_pass http://pihole;
        }
    }

On another location I am running Confluence. I have setup the docker-compose for pihole to bind port 8080:80 and apparently this is fine for pihole:

  pihole:
    image: diginc/pi-hole
    restart: always
    cap_add:
      - NET_ADMIN
    environment:
      - ServerIP=192.168.5.201
      - DNS1=192.168.5.1
      - DNS2=8.8.8.8
    ports:
      - "53:53"
      - "8080:80"

I bet it is an user error...
Thanks!

Set TimeZone

I have looked for an easy way to set the timezone but the container doesn't seem to have the tools needed to change it.
bash: dpkg-reconfigure: command not found

"docker-pi-hole users update their docker images, not git code" why ?

The docker image prevents pi-hole updates through git.

While I understand that a docker pull/restart does the job, why removing the ability to update through git? I would be fine with having my pi-hole update itself without restart the container, still knowing that in case of trouble I can always pull/rm/up a new container.

Maybe I'm missing something obvious?

Error loading html/admin/data.php

I'm on the latest version of pihole that was released today. I'm not sure if this happens on the older version(s).

Pi-hole Version V2.9.1
Web Interface Version v1.4.2
Platform: Unraid 6.2

I see the following repeated errors in the logs but everything appears to work otherwise. Is this why the logs need to be flushed using the cron?

==> /var/log/nginx/access.log <==
192.168.1.179 - - [01/Oct/2016:19:01:22 +0000] "GET /admin/api.php?summary HTTP/1.1" 200 128 "http://192.168.1.10/admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.41 Safari/537.36"

==> /var/log/nginx/error.log <==

2016/10/01 19:01:22 [error] 224#224: *1 FastCGI sent in stderr: "PHP message: PHP Warning: parse_ini_file(/etc/pihole/setupVars.conf): failed to open stream: No such file or directory in /var/www/html/admin/data.php on line 3" while reading response header from upstream, client: 192.168.1.179, server: , request: "GET /admin/api.php?summary HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.10", referrer: "http://192.168.1.10/admin/"


==> /var/log/nginx/access.log <==
192.168.1.179 - - [01/Oct/2016:19:01:33 +0000] "GET /admin/api.php?summary HTTP/1.1" 200 128 "http://192.168.1.10/admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.41 Safari/537.36"

==> /var/log/nginx/error.log <==

2016/10/01 19:01:33 [error] 224#224: *1 FastCGI sent in stderr: "PHP message: PHP Warning: parse_ini_file(/etc/pihole/setupVars.conf): failed to open stream: No such file or directory in /var/www/html/admin/data.php on line 3" while reading response header from upstream, client: 192.168.1.179, server: , request: "GET /admin/api.php?summary HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.10", referrer: "http://192.168.1.10/admin/"


==> /var/log/nginx/access.log <==
192.168.1.179 - - [01/Oct/2016:19:01:43 +0000] "GET /admin/api.php?summary HTTP/1.1" 200 128 "http://192.168.1.10/admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.41 Safari/537.36"

==> /var/log/nginx/error.log <==

2016/10/01 19:01:43 [error] 224#224: *1 FastCGI sent in stderr: "PHP message: PHP Warning: parse_ini_file(/etc/pihole/setupVars.conf): failed to open stream: No such file or directory in /var/www/html/admin/data.php on line 3" while reading response header from upstream, client: 192.168.1.179, server: , request: "GET /admin/api.php?summary HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", h
```ost: "192.168.1.10", referrer: "http://192.168.1.10/admin/"

Alpine build failing due to php package constraints

Suddenly the build is failing:

 docker build --no-cache -f alpine.docker -t dockerpihole_alpine .                             
Sending build context to Docker daemon 36.53 MB
Step 1 : FROM alpine:edge
 ---> 045f01e9d4ee
Step 2 : MAINTAINER [email protected] <[email protected]>
 ---> Running in eaae5254feca
 ---> b8940079ce05
Removing intermediate container eaae5254feca
Step 3 : RUN apk add --update         dnsmasq         nginx         ca-certificates         php-fpm php-json libxml2         bc bash curl perl &&     apk add --update --repository http://dl-1.alpinelinux.org/alpine/edge/testing/ tini &&     rm -rf /var/cache/apk/*
 ---> Running in 320bc0b90bee
fetch http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  php-fpm (missing):
    required by: world[php-fpm]
  php-json (missing):
    required by: world[php-json]
The command '/bin/sh -c apk add --update         dnsmasq         nginx         ca-certificates         php-fpm php-json libxml2         bc bash curl perl &&     apk add --update --repository http://dl-1.alpinelinux.org/alpine/edge/testing/ tini &&     rm -rf /var/cache/apk/*' returned a non-zero code: 2

Something keeps resetting password

Ok.. i thought I was losing my mind but I think every time the external cron runs to refresh the lists, the webpassword gets changed inside setupVars. Yesterday I made a copy of the file after I had fixed the pihole password again, and today I see the file has changed somehow

โ””โ”€โ”€โ•ผ diff setupVars.conf setupVars.conf.orig
9d8
< WEBPASSWORD=98f40829900af94a8d4...snip
11a11

WEBPASSWORD=cdc7a077f771937ea3a...snip

-rw-r--r-- 1 root root 326 Feb 21 20:59 setupVars.conf.orig
-rw-r--r-- 1 root root 326 Feb 22 15:51 setupVars.conf
-rw-r--r-- 1 root root 3.0K Feb 22 15:51 adlists.default
-rw------- 1 root root 1.1M Feb 22 15:51 list.0.raw.githubusercontent.com.domains
-rw-r--r-- 1 root root 2.3M Feb 22 15:51 list.preEventHorizon
-rw-r--r-- 1 root root 45 Feb 22 15:51 local.list
-rw-r--r-- 1 root root 3.5M Feb 22 15:51 gravity.list

What's weird is my docker.pihole cron doesn't have an entry to run at 3:51pm

59 1 * * 7 root PATH="$PATH:/usr/local/bin/" docker exec $DOCKER_NAME pihole updateGravity > /dev/null

The only thing in my logs is
Feb 22 15:50:36 trinity crond[1153]: (CRON) INFO (Shutting down)
Feb 22 15:51:26 trinity crond[878]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 19% if used.)
Feb 22 15:51:26 trinity crond[878]: (CRON) INFO (running with inotify support)

Which I believe is anacron doing something..

All of my /etc/cron.* directories don't have anything in them other than docker.pihole cron and a logwatch/aide cron.

Change default web port

Could you change the default port to something else? Port 80 is a pain on my server, at the moment I just mount a custom lighttpd.conf (changed 80 to 8088) to /etc/lighttpd/lighttpd.conf and it works like a charm.

The reverse proxy solution isn't always easy and this is a quick solution, you could just load an editted conf file with the dockerfile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.