Go to file
diginc 08f49d3ffa Merge pull request #11 from diginc/2.6.2_update
Updated version, support for custom DNS server override env vars
2016-04-25 23:25:54 -05:00
AdminLTE@25bc98348f Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
alpine Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
debian Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
pi-hole@3853997295 Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
.gitignore alpine nginx pihole working, weighing in at 85.36 MB vs debian 252.4 MB 2016-02-13 13:24:44 -06:00
.gitmodules switch to pihole upstream submodule / not fork 2016-02-24 09:02:47 -06:00
.travis.yml first attempt at travis build 2016-03-29 22:04:36 -05:00
AdminLTE_version.txt Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
Dockerfile alpine nginx pihole working, weighing in at 85.36 MB vs debian 252.4 MB 2016-02-13 13:24:44 -06:00
README.md Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
alpine.docker Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
debian.docker Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
docker-compose.yml alpine nginx pihole working, weighing in at 85.36 MB vs debian 252.4 MB 2016-02-13 13:24:44 -06:00
docker_dev.sh Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
docker_run.sh Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
doco-alpine.yml Version in the web interfaces works now! (various) 2016-03-29 19:51:08 -05:00
doco-debian.yml Version in the web interfaces works now! (various) 2016-03-29 19:51:08 -05:00
doco-example.yml docker-compose example updated 2016-03-30 15:24:47 -05:00
jwilder-proxy-example-doco.yml adding another docker compose example based off my setup, making sure doco examples are all using the latest environment variable for piholeIP (host ip) 2016-03-28 21:42:11 -05:00
make_symlinks.sh alpine nginx pihole working, weighing in at 85.36 MB vs debian 252.4 MB 2016-02-13 13:24:44 -06:00
pi-hole_version.txt Updated version, support for custom DNS server override env vars 2016-04-25 23:18:41 -05:00
requirements.txt initial version of monolithic debian docker & WIP alpine. 2016-02-01 22:58:09 -06:00
update.sh Version in the web interfaces works now! (various) 2016-03-29 19:51:08 -05:00

README.md

A Docker project to make lightweight x86 continers with pi-hole functionality.

Build Status

April 25, 2016 Update: piholeIP env var replaced by ServerIP env var, update your docker run/docker-compose configs accordingly please.

Basic Docker Usage

If you have no other dockers using port 80 (if you do, read the list below for reverse proxy advice), the minimum options required to run this container are in the script docker_run.sh:

To customize your upstream DNS servers you use docker environment varibales of DNS1 and DNS2 passed into docker at runtime. The default servers are Google's 8.8.8.8 and 8.8.4.4.

IP=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
docker run -p 53:53/tcp -p 53:53/udp -p 80:80 --cap-add=NET_ADMIN -e piholeIP="$IP" --name pihole -d diginc/pi-hole
  • piholeIP environment variable is required or default pi-hole scripts autodetect and give ads the private docker ip address that is not on your network so won't work.
  • A good way to test things are working right is by loading this page: http://pi-hole.isworking.ok/admin/
  • Here is an example of running with jwilder/proxy (an nginx auto-configuring docker reverse proxy for docker) on my port 80 with pihole on another porg. Pi-hole needs to be DEFAULT_HOST env in jwilder/proxy and you need to set the matching VIRTUAL_HOST for the pihole. Please read jwilder/proxy readme for more info if you have trouble. I tested this basic exmaple which is based off what I run.
  • If you have something else taking up port 80 then the ads may not transform into blank ads correctly. The solution to this is to make sure whatever you do have as the 'default' port 80 virtual host is redirect to this container.
  • dnsmasq requires NET_ADMIN capabilities to run correctly in docker.

Updating ad sources - Just run a docker restart your_pihole_name to kick off the gravity script which updates all the ad lists.

Here are some useful volume mount options to persist your history of stats in the admin interface, or add custom whitelists/blacklists. Create these files on the docker host first or you'll get errors:

  • docker run -v /var/log/pihole.log:/var/log/pihole.log ... (plus all of the minimum options added)
  • docker run -v /etc/pihole/blacklist.txt:/etc/pihole/blacklist.txt ... (plus all of the minimum options added)
  • docker run -v /etc/pihole/whitelist.txt:/etc/pihole/whitelist.txt ... (plus all of the minimum options added)
  • if you use this you should probably read the Advanced Usage section

All of these options get really long when strung together in one command, which is why I'm not going to show all the full commands variations. This is where docker-compose yml files come in handy for representing really long docker commands in a readable file format.

Docker tags

Alpine

This is an optimized docker using alpine as its base. It uses nginx instead of lighttpd.

Debian

This version of the docker aims to be as close to a standard pi-hole installation by using the same base OS and the exact configs and scripts (minimally modified to get them working). This serves as a nice baseline for merging and testing upstream repository pi-hole changes.

Advanced Usage and Notes

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. Volumes are also important to persist the configuration incase you have remove the pi-hole container which is a typical docker upgrade pattern.

Customizing with volume mounts

Here are some relevant wiki pages from pi-hole's documentation and example volume mappings to optionally add to the basic example:

  • Customizing sources for ad lists
  • -v your-adlists.list:/etc/pihole/adlists.list Your version should probably start with the existing defaults for this file.
  • Whitlisting and Blacklisting
  • -v your-whitelist:/etc/pihole/whitelist.txt Your version should probably start with the existing defaults for this file.
  • -v your-blacklist:/etc/pihole/blacklist.txt This one is empty by default

Scripts inside the docker

The original pi-hole scripts are in the container, so they should work for the debian version, via docker exec like so:

  • docker exec pihole_container_name whitelist.sh some-good-domain.com
  • docker exec pihole_container_name blacklist.sh some-bad-domain.com

diginc/pi-hole:debian has working service command functionality, which the original scripts also use to reload after configuration changes. diginc/pi-hole:alpine does not use service, so while the scripts may (or may not) work, to make the changes scripts make take effect please run docker restart pihole.