⚠️ The setup is very very very experimental and not stable at all.
Docker setup for pi-hole
·
Report Bug
·
Request Feature
Small docker setup for pi-hole.
To get a local copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/beuluis/pi-hole.git
- Start docker-compose
docker-compose up --build
-
Overwrite all variables marked under Customization as required
-
Change your DNS settings
- Create a
.env
file
touch .env
- Overwrite variables as you like (format:
{variable name}={variable value}
)
Variable | Description | Default value | Required |
---|---|---|---|
PH_TZ |
Set an administrative contact address for the Block Page | Europe/Berlin |
false |
PH_ADMIN_EMAIL |
Set your timezone to make sure logs rotate at local midnight instead of at UTC midnight. | none | true |
PH_DNS1 |
Primary upstream DNS provider, default is google DNS | 8.8.8.8 |
false |
PH_DNS2 |
Secondary upstream DNS provider, default is google DNS, no if only one DNS should used | 8.8.4.4 |
false |
PH_DNSSEC |
Enable DNSSEC support | true |
false |
PH_DNS_BOGUS_PRIV |
Enable forwarding of reverse lookups for private ranges | true |
false |
PH_DNS_FQDN_REQUIRED |
Never forward non-FQDNs | false |
false |
PH_REV_SERVER |
Enable DNS conditional forwarding for device name resolution | none | false |
PH_REV_SERVER_DOMAIN |
If conditional forwarding is enabled, set the domain of the local network router | none | false |
PH_REV_SERVER_TARGET |
If conditional forwarding is enabled, set the IP of the local network router | none | false |
PH_REV_SERVER_CIDR |
If conditional forwarding is enabled, set the reverse DNS zone (e.g. 192.168.0.0/24) | none | false |
PH_SERVER_IP |
--net=host mode requires Set to your server's LAN IP, used by web block modes and lighttpd bind address | none | true or PH_SERVER_IPV6 |
PH_SERVER_IPV6 |
If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fully | none | true or PH_SERVER_IP |
PH_VIRTUAL_HOST |
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 | none | false |
PH_IPV6 |
For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false. | true |
false |
PH_INTERFACE |
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. | none | false |
PH_DNSMASQ_LISTENING |
local listens on all local subnets, all permits listening on internet origin subnets in addition to local. | none | false |
PH_WEB_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] (https://discourse.pi-hole.net/t/alternative-synology-installation-method/5454?u=diginc) | none | false |
PH_DNSMASQ_USER |
Allows running FTLDNS as non-root. | root |
false |
PH_TEMPERATUREUNIT |
Set preferred temperature unit to c: Celsius, k: Kelvin, or f Fahrenheit units. | c |
false |
PH_WEBUIBOXEDLAYOUT |
Use boxed layout (helpful when working on large screens) | boxed |
false |
PH_SKIPGRAVITYONBOOT |
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. | none | false |
PH_WEBPASSWORD |
http://pi.hole/admin password. Run `docker logs pihole | grep random` to find your random pass. | 28TjoNC4N0pTbahcquS7TS |
Additional documentation from pi-hole |
To get a copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/beuluis/pi-hole.git --branch master
- Create a
.env.prod
file
touch .env.prod
- Overwrite all variables marked under Customization as required
- Start docker-compose
docker-compose --env-file ./.env.prod -f docker-compose.yml -f docker-compose.production.yml up -d
- Change your DNS settings
- Create a
.env.prod
file
touch .env.prod
- Overwrite variables as you like (format:
{variable name}={variable value}
)
Variable | Description | Default value | Required |
---|---|---|---|
PH_TZ |
Set an administrative contact address for the Block Page | Europe/Berlin |
false |
PH_ADMIN_EMAIL |
Set your timezone to make sure logs rotate at local midnight instead of at UTC midnight. | none | true |
PH_DNS1 |
Primary upstream DNS provider, default is google DNS | 8.8.8.8 |
false |
PH_DNS2 |
Secondary upstream DNS provider, default is google DNS, no if only one DNS should used | 8.8.4.4 |
false |
PH_DNSSEC |
Enable DNSSEC support | true |
false |
PH_DNS_BOGUS_PRIV |
Enable forwarding of reverse lookups for private ranges | true |
false |
PH_DNS_FQDN_REQUIRED |
Never forward non-FQDNs | false |
false |
PH_REV_SERVER |
Enable DNS conditional forwarding for device name resolution | none | false |
PH_REV_SERVER_DOMAIN |
If conditional forwarding is enabled, set the domain of the local network router | none | false |
PH_REV_SERVER_TARGET |
If conditional forwarding is enabled, set the IP of the local network router | none | false |
PH_REV_SERVER_CIDR |
If conditional forwarding is enabled, set the reverse DNS zone (e.g. 192.168.0.0/24) | none | false |
PH_SERVER_IP |
--net=host mode requires Set to your server's LAN IP, used by web block modes and lighttpd bind address | none | true or PH_SERVER_IPV6 |
PH_SERVER_IPV6 |
If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fully | none | true or PH_SERVER_IP |
PH_VIRTUAL_HOST |
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 | none | false |
PH_IPV6 |
For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false. | true |
false |
PH_INTERFACE |
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. | none | false |
PH_DNSMASQ_LISTENING |
local listens on all local subnets, all permits listening on internet origin subnets in addition to local. | none | false |
PH_WEB_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] (https://discourse.pi-hole.net/t/alternative-synology-installation-method/5454?u=diginc) | none | false |
PH_DNSMASQ_USER |
Allows running FTLDNS as non-root. | root |
false |
PH_TEMPERATUREUNIT |
Set preferred temperature unit to c: Celsius, k: Kelvin, or f Fahrenheit units. | c |
false |
PH_WEBUIBOXEDLAYOUT |
Use boxed layout (helpful when working on large screens) | boxed |
false |
PH_SKIPGRAVITYONBOOT |
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. | none | false |
PH_WEBPASSWORD |
http://pi.hole/admin password. Run `docker logs pihole | grep random` to find your random pass. | none |
Additional documentation from pi-hole |
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Luis Beu - [email protected]