diff --git a/README.md b/README.md index d4982f1..fbd3c6f 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,12 @@ ```yaml 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" @@ -64,7 +65,7 @@ These are the raw [docker run cli](https://docs.docker.com/engine/reference/comm A [Docker](https://www.docker.com/what-docker) project to make a lightweight x86 and ARM container with [Pi-hole](https://pi-hole.net) functionality. -1) Install docker and docker-compose for your [x86-64 system](https://www.docker.com/community-edition) or [ARMv7 system](https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/) using those links. +1) Install docker for your [x86-64 system](https://www.docker.com/community-edition) or [ARMv7 system](https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/) using those links. [Docker-compose](https://docs.docker.com/compose/install/) is also recommended. 2) Use the above quick start example, customize if desired. 3) Enjoy! @@ -87,6 +88,10 @@ Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used **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](https://docs.pi-hole.net/docker/DHCP/) + ## Environment Variables There are other environment variables if you want to customize various things inside the docker container: @@ -134,7 +139,7 @@ Here is a rundown of other arguments for your docker-compose / docker run. * Don't forget to stop your services from auto-starting again after you reboot * Port 80 is highly recommended because if you have another site/service using port 80 by default then the ads may not transform into blank ads correctly. To make sure docker-pi-hole plays nicely with an existing webserver you run you'll probably need a reverse proxy webserver config if you don't have one already. Pi-hole must be the default web app on the proxy e.g. if you go to your host by IP instead of domain then Pi-hole is served out instead of any other sites hosted by the proxy. This is the '[default_server](http://nginx.org/en/docs/http/ngx_http_core_module.html#listen)' in nginx or ['_default_' virtual host](https://httpd.apache.org/docs/2.4/vhosts/examples.html#default) in Apache and is taken advantage of so any undefined ad domain can be directed to your webserver and get a 'blocked' response instead of ads. * You can still map other ports to Pi-hole port 80 using docker's port forwarding like this `-p 8080:80`, but again the ads won't render properly. Changing the inner port 80 shouldn't be required unless you run docker host networking mode. - * [Here is an example of running with jwilder/proxy](https://github.com/pi-hole/docker-pi-hole/blob/master/jwilder-proxy-example-doco.yml) (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 jwilder/proxy and you need to set the matching `VIRTUAL_HOST` for the Pi-hole's container. Please read jwilder/proxy readme for more info if you have trouble. I tested this basic example which is based off what I run. + * [Here is an example of running with jwilder/proxy](https://github.com/pi-hole/docker-pi-hole/blob/master/docker-compose-jwilder-proxy.yml) (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 jwilder/proxy and you need to set the matching `VIRTUAL_HOST` for the Pi-hole's container. Please read jwilder/proxy readme for more info if you have trouble. ## Docker tags and versioning diff --git a/jwilder-proxy-example-doco.yml b/docker-compose-jwilder-proxy.yml similarity index 79% rename from jwilder-proxy-example-doco.yml rename to docker-compose-jwilder-proxy.yml index bb4b5bb..b343bc4 100644 --- a/jwilder-proxy-example-doco.yml +++ b/docker-compose-jwilder-proxy.yml @@ -1,3 +1,7 @@ +version: "3" + +# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md + applist: image: jwilder/nginx-proxy ports: @@ -22,11 +26,12 @@ pihole: volumes: - './etc-pihole/:/etc/pihole/' - './etc-dnsmasq.d/:/etc/dnsmasq.d/' - - './var-log/pihole.log:/var/log/pihole.log' - # The 3 lines below are required if Pi-hole is to provide DHCP - # cap_add: - # - NET_ADMIN - # network_mode: "host" + # run `touch ./var-log/pihole.log` first unless you like errors + # - './var-log/pihole.log:/var/log/pihole.log' + # Recommended but not required (DHCP needs NET_ADMIN) + # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities + cap_add: + - NET_ADMIN environment: ServerIP: 192.168.41.55 PROXY_LOCATION: pihole diff --git a/traefik-docker-compose-example.md b/docker-compose-traefik-proxy.md similarity index 92% rename from traefik-docker-compose-example.md rename to docker-compose-traefik-proxy.md index 5cc176d..281c054 100644 --- a/traefik-docker-compose-example.md +++ b/docker-compose-traefik-proxy.md @@ -1,14 +1,14 @@ -Please note the following about this [traefik](https://traefik.io/) example for pihole. +Please note the following about this [traefik](https://traefik.io/) example for Docker Pi-hole -- Still requires standard pi-hole setup steps, make sure you've gone through the [README](https://github.com/pihole/docker-pi-hole/blob/master/README.md) and understand how to setup pihole without traefik first +- Still requires standard Pi-hole setup steps, make sure you've gone through the [README](https://github.com/pihole/docker-pi-hole/blob/master/README.md) and understand how to setup Pi-hole without traefik first - Update these things before using: - set instances of `homedomain.lan` below to your home domain (typically set in your router) - - set your pihole ENV WEBPASSWORD if you don't want a random admin pass + - set your Pi-hole ENV WEBPASSWORD if you don't want a random admin pass - This works for me, Your mileage may vary! - For support, do your best to figure out traefik issues on your own: - by looking at logs and traefik web interface on port 8080 - also by searching the web and searching their forums/docker issues for similar question/problems -- Port 8053 is mapped directly to pihole to serve as a back door without going through traefik +- Port 8053 is mapped directly to Pi-hole to serve as a back door without going through traefik - There is some delay after starting your container before traefik forwards the HTTP traffic correctly, give it a minute ``` @@ -53,10 +53,10 @@ services: - '0.0.0.0:67:67/udp' - '0.0.0.0:8053:80/tcp' volumes: - # run `touch ./pihole.log` first unless you like errors - # - ./pihole.log:/var/log/pihole.log - ./etc-pihole/:/etc/pihole/ - ./etc-dnsmasqd/:/etc/dnsmasq.d/ + # run `touch ./pihole.log` first unless you like errors + # - ./pihole.log:/var/log/pihole.log environment: ServerIP: 192.168.1.50 PROXY_LOCATION: pihole diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 120000 index d913f33..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1 +0,0 @@ -doco-example.yml \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..22ab2da --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3" + +# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md + +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" + - "80:80/tcp" + - "443:443/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/' + # run `touch ./var-log/pihole.log` first unless you like errors + # - './var-log/pihole.log:/var/log/pihole.log' + dns: + - 127.0.0.1 + - 1.1.1.1 + # Recommended but not required (DHCP needs NET_ADMIN) + # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities + cap_add: + - NET_ADMIN + restart: unless-stopped diff --git a/doco-example.yml b/doco-example.yml deleted file mode 100644 index 4064fcf..0000000 --- a/doco-example.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: "3" - -# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md - -version: "3" -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" - - "80:80/tcp" - - "443:443/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/' - dns: - - 127.0.0.1 - - 1.1.1.1 - # Recommended but not required (DHCP needs NET_ADMIN) - # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities - cap_add: - - NET_ADMIN - restart: unless-stopped diff --git a/doco-example.yml b/doco-example.yml new file mode 120000 index 0000000..412c257 --- /dev/null +++ b/doco-example.yml @@ -0,0 +1 @@ +docker-compose.yml \ No newline at end of file