Skip to content

Commit 1a43a6b

Browse files
committed
move info from docker readme to the docs
Signed-off-by: Adam Warner <[email protected]>
1 parent 8584f42 commit 1a43a6b

File tree

3 files changed

+102
-14
lines changed

3 files changed

+102
-14
lines changed

docs/docker/configuration.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- markdownlint-disable MD051 -->
12
# Configuration
23

34
The recommended way to configure the Pi-hole docker container is by utilizing [environment variables](https://docs.docker.com/compose/how-tos/environment-variables/), however if you are persisting your `/etc/pihole` directory, you choose instead to set them via the web interface, or by directly editing `pihole.toml`
@@ -99,7 +100,7 @@ Environment variables may be set in the format given here, or they may be entire
99100

100101
For example, both `FTLCONF_dns_upstreams` and `FTLCONF_DNS_UPSTREAMS` are functionally equivalent when used as environment variables.
101102

102-
## Notes On Web Interface Password
103+
## Notes On Web Interface Password {: #notes-on-web-interface-password }
103104

104105
The web interface password can be set using the `FTLCONF_webserver_api_password` environment variable as documented above or using the `WEBPASSWORD_FILE` environment variable using [Docker Compose Secrets](https://docs.docker.com/compose/how-tos/use-secrets/) or [Docker Swarm secrets](https://docs.docker.com/engine/swarm/secrets/).
105106

@@ -148,7 +149,7 @@ ADMIN_PASSWORD=correct horse battery staple
148149
$ docker compose -f compose.yaml
149150
```
150151

151-
### `WEBPASSWORD_FILE` Example
152+
### `WEBPASSWORD_FILE` Example {: #webpassword_file-example }
152153

153154
Create a text file called `pihole_password.txt` containing the password in the same directory containing the Compose yaml file (e.g `compose.yaml`).
154155

@@ -185,3 +186,61 @@ secrets:
185186
...
186187
```
187188

189+
## Configuration Reference
190+
191+
### Recommended Environment Variables
192+
193+
| Variable | Default | Value | Description |
194+
| :--- | :--- | :--- | :--- |
195+
| `TZ` | UTC | `<Timezone>` | Set your [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to make sure logs rotate at local midnight instead of at UTC midnight. |
196+
| `FTLCONF_webserver_api_password` | random | `<Admin password>` | <http://pi.hole/admin> password.<br>Run `docker logs pihole \| grep random` to find your random password. |
197+
| `FTLCONF_dns_upstreams` | `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.<br><br>Supports non-standard ports with: `#[port number]`, e.g `127.0.0.1#5053;8.8.8.8;8.8.4.4`.<br><br>Supports [Docker service names and links](https://docs.docker.com/compose/networking/) instead of IPs, e.g `upstream0,upstream1` where `upstream0` and `upstream1` are the service names of or links to docker services.<br><br>**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. |
198+
199+
### Optional Variables
200+
201+
| Variable | Default | Value | Description |
202+
| :--- | :--- | :--- | :--- |
203+
| `TAIL_FTL_LOG` | `1` | `<0\|1>` | Whether or not to output the FTL log when running the container. Can be disabled by setting the value to 0. |
204+
| `FTLCONF_[SETTING]` | unset | As per documentation | Customize pihole.toml with settings described in the [API Documentation](https://docs.pi-hole.net/api).<br><br>Replace `.` with `_`, e.g for `dns.dnssec=true` use `FTLCONF_dns_dnssec: 'true'`.<br/>Array type configs should be delimited with `;`. |
205+
| `PIHOLE_UID` | `1000` | Number | Overrides image's default pihole user id to match a host user id.<br/>**IMPORTANT**: id must not already be in use inside the container! |
206+
| `PIHOLE_GID` | `1000` | Number | Overrides image's default pihole group id to match a host group id.<br/>**IMPORTANT**: id must not already be in use inside the container! |
207+
| `WEBPASSWORD_FILE` | unset | `<Docker secret file>` | Set an Admin password using Docker secrets with [Swarm](https://docs.docker.com/engine/swarm/secrets/) or [Compose](https://docs.docker.com/compose/how-tos/use-secrets/). If `FTLCONF_webserver_api_password` is set, `WEBPASSWORD_FILE` is ignored. If `FTLCONF_webserver_api_password` is empty, and `WEBPASSWORD_FILE` is set to a valid readable file, then `FTLCONF_webserver_api_password` will be set to the contents of `WEBPASSWORD_FILE`. See [WEBPASSWORD_FILE Example](#webpassword_file-example) for additional information. |
208+
209+
### Advanced Variables
210+
211+
| Variable | Default | Value | Description |
212+
| :--- | :--- | :--- | :--- |
213+
| `FTL_CMD` | `no-daemon` | `no-daemon -- <dnsmasq option>` | Customize dnsmasq startup options. e.g. `no-daemon -- --dns-forward-max 300` to increase max. number of concurrent dns queries on high load setups. |
214+
| `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`.<br><br>(See [#963](https://github.com/pi-hole/docker-pi-hole/issues/963)) |
215+
| `ADDITIONAL_PACKAGES` | unset | Space separated list of APKs | HERE BE DRAGONS. Mostly for development purposes, this just makes it easier for those of us that always like to have whatever additional tools we need inside the container for debugging. |
216+
| `FTLCONF_misc_etc_dnsmasq_d` | false | `true\|false` | Load custom user configuration files from `/etc/dnsmasq.d/` |
217+
218+
### Docker Arguments
219+
220+
Here is a rundown of other arguments for your docker-compose / docker run.
221+
222+
| Docker Arguments | Description |
223+
| :--- | :--- |
224+
| `-p <port>:<port>` **Recommended** | Ports to expose (53, 80, 443, 67), the bare minimum ports required for Pi-holes HTTP, HTTPS and DNS services. |
225+
| `--restart=unless-stopped`<br/> **Recommended** | Automatically (re)start your Pi-hole on boot or in the event of a crash. |
226+
| `-v $(pwd)/etc-pihole:/etc/pihole`<br/> **Recommended** | Volumes for your Pi-hole configs help persist changes across docker image updates. |
227+
| `--net=host`<br/> _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. |
228+
| `--cap-add=NET_ADMIN`<br/> _Recommended_ | Commonly added capability for DHCP, see [Note on Capabilities](#note-on-capabilities) below for other capabilities. |
229+
| `--dns=n.n.n.n`<br/> _Optional_ | Explicitly set container's DNS server. It is **_not recommended_** to set this to `localhost`/`127.0.0.1`. |
230+
| `--env-file .env` <br/> _Optional_ | File to store environment variables for docker replacing `-e key=value` settings. Here for convenience. |
231+
232+
## Note on Capabilities {: #note-on-capabilities }
233+
234+
Pi-hole's DNS core (FTL) expects to have the following capabilities available:
235+
236+
- `CAP_NET_BIND_SERVICE`: Allows FTLDNS binding to TCP/UDP sockets below 1024 (specifically DNS service on port 53)
237+
- `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)
238+
- `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)
239+
- `CAP_SYS_NICE`: FTL sets itself as an important process to get some more processing time if the latter is running low
240+
- `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`
241+
- `CAP_SYS_TIME`: FTL needs to be able to set the system time to update it using the Network Time Protocol (NTP) in the background
242+
243+
This image automatically grants those capabilities, if available, to the FTLDNS process, even when run as non-root.\
244+
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`.\
245+
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.
246+

docs/docker/index.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,19 @@ The equivalent command for `docker run` would be:
5353
docker run --name pihole -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -e TZ=Europe/London -e FTLCONF_webserver_api_password="correct horse battery staple" -e FTLCONF_dns_listeningMode=all -v ./etc-pihole:/etc/pihole -v ./etc-dnsmasq.d:/etc/dnsmasq.d --cap-add NET_ADMIN --restart unless-stopped pihole/pihole:latest
5454
```
5555

56-
## Note On Capabilities
5756

58-
[FTLDNS](https://docs.pi-hole.net/ftldns/) expects to have the following capabilities available:
57+
## Docker tags and versioning
5958

60-
- `CAP_NET_BIND_SERVICE`: Allows FTLDNS binding to TCP/UDP sockets below 1024 (specifically DNS service on port 53)
61-
- `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)
62-
- `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)
63-
- `CAP_SYS_NICE`: FTL sets itself as an important process to get some more processing time if the latter is running low
64-
- `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`
65-
- `CAP_SYS_TIME`: FTL needs to be able to set the system time to update it using the Network Time Protocol (NTP) in the background
59+
The primary docker tags are explained in the following table. [Click here to see the full list of tags](https://hub.docker.com/r/pihole/pihole/tags). See [GitHub Release notes](https://github.com/pi-hole/docker-pi-hole/releases) to see the specific version of Pi-hole Core, Web, and FTL included in the release.
6660

67-
!!! info
68-
This image automatically grants those capabilities, if available, to the FTLDNS process, even when run as non-root.
61+
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.
6962

70-
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`.
63+
Release notes will always contain full details of changes in the container, including changes to core Pi-hole components.
7164

72-
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.
65+
| tag | description |
66+
| :--- | :--- |
67+
| `latest` | Always the latest release |
68+
| `2022.04.0` | Date-based release |
69+
| `2022.04.1` | Second release in a given month |
70+
| `*beta` | Early beta releases of upcoming versions - here be dragons |
71+
| `nightly` | Built and pushed whenever there are changes on the `development` branch and additionally produced by the scheduled nightly job. These are the most experimental development images and may change frequently |

docs/docker/tips-and-tricks.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,33 @@ Example sysconfig nmcli commands:
6969
```bash
7070
nmcli connection up ens160-night
7171
```
72+
73+
## Common Issues
74+
75+
- A good way to test things are working right is by loading this page: [http://pi.hole/admin/](http://pi.hole/admin/)
76+
- Port conflicts? Stop your server's existing DNS / Web services.
77+
- Don't forget to stop your services from auto-starting again after you reboot.
78+
- Ubuntu users see below for more detailed information.
79+
- If only ports 80 and/or 443 are in use, you have two options:
80+
- Change the container's port mapping by adjusting the Docker `-p` flags or the `ports:` section in the compose file. For example, change `- "80:80/tcp"` to `- "8080:80/tcp"` to expose the container’s internal HTTP port 80 as 8080 on the host.
81+
- Or, when running the container in `network_mode: host`, where port mappings are not available, change the ports used by the Pi-hole web server using the `FTLCONF_webserver_port` environment variable.<br>
82+
Example:<br>
83+
`FTLCONF_webserver_port: '8080o,[::]:8080o,8443os,[::]:8443os'`<br>
84+
This makes the web interface available on HTTP port 8080 and HTTPS port 8443 for both IPv4 and IPv6.
85+
- **Note:** This only applies to web interface ports (80 and 443). DNS (53), DHCP (67), and NTP (123) ports must still be handled via Docker port mappings or host networking.
86+
- 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".
87+
- If you're using a Red Hat based distribution with an SELinux Enforcing policy, add `:z` to line with volumes.
88+
89+
## Note on Watchtower
90+
91+
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:
92+
93+
- **Important**: Read the release notes. Sometimes you will need to make changes other than just updating the image.
94+
- Pull the new image.
95+
- Stop and _remove_ the running Pi-hole container
96+
- If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
97+
- Recreate the container using the new image.
98+
99+
To exclude the Pi-hole container from Watchtower's auto-update system take a look at [Full Exclude](https://containrrr.dev/watchtower/container-selection/#full_exclude) in Watchtower's docs.
100+
101+
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.

0 commit comments

Comments
 (0)