Pihole 6 docker custom local dns file

What have you tried? :slight_smile:

For Docker, the recommended way of persisting your configuration is to use environment variables. This ensure that you have a repeatable config that remains fairly static no matter where you spin it up (obvious exception of this is persisting the sqlite databases, which will require volume mounts)

For local DNS records you can add them to the environment in your docker compose file like:

environment:
    FTLCONF_dns_hosts: '127.0.0.1 google.com;127.0.0.2 facebook.com'

edit:

You can also add them like this if you have many and want it to be easier to read in the compose file - and each one will work, but currently they will look odd on the UI

environment:
  FTLCONF_dns_hosts: |
      127.0.0.1 google.com
      127.0.0.2 facebook.com
      127.0.0.3 somethingelse.com

As a side note:

For a bare metal install, the --unattended flag still works, but things have changed since v5. The new config file is named pihole.toml. If you preseed this file and place it in /etc/pihole/pihole.toml - you can run the install script on a fresh system with the --unattended flag and it will read in the pre-seeded values.

The equivalent to custom.list in this case would be adding the local records to dns.hosts and dns.cnameRecords within the toml:

[dns]
  # Array of custom DNS records
  # Example: hosts = [ "127.0.0.1 mylocal", "192.168.0.1 therouter" ]
  #
  # Possible values are:
  #     Array of custom DNS records each one in HOSTS form: "IP HOSTNAME"
  hosts = [
    "127.0.0.1 google.com",
    "127.0.0.2 facebook.com"
  ] ### CHANGED (env), default = []