Sign inSign up

allancoding/pihole-libseccomp2-fix

By allancoding

•Updated about 4 years ago

pihole fixed libseccomp2

Image
0

317

allancoding/pihole-libseccomp2-fix repository overview

⁠Docker Pi-hole

Pi-hole

⁠Changes!

⁠Changes from the pihole/pihole:

  • ⁠libseccomp2 is fixed

⁠Upgrade Notes

  • Using Watchtower? See the Note on Watchtower⁠ at the bottom of this readme

  • Due to a known issue with Docker and libseccomp <2.5⁠, you may run into issues running 2022.04 and later on host systems with an older version of libseccomp2 (Such as Debian/Raspbian buster or Ubuntu 20.04⁠, and maybe CentOS 7⁠).

    The first recommendation is to upgrade your host OS, which will include a more up to date (and fixed) version of libseccomp.

    If you absolutely cannot do this, some users have reported⁠ success in updating libseccomp2 via backports on debian, or similar via updates on Ubuntu. You can try this workaround at your own risk (Note, you may also find that you need the latest docker.io (more details here⁠)

  • Some users have reported issues⁠ with using the --privileged flag on 2022.04 and above. TL;DR, don't use that mode, and be explicit with the permitted caps⁠ (if needed) instead

  • As of 2022.04.01, setting CAP_NET_ADMIN is only required if you are using Pi-hole as your DHCP server. The container will only try to set caps that are explicitly granted (or natively available)

  • In 2022.01 and later, the default DNSMASQ_USER has been changed to pihole, however this may cause issues on some systems such as Synology, see Issue #963⁠ for more information. If the container won't start due to issues setting capabilities, set DNSMASQ_USER to root in your environment.

⁠Quick Start

  1. Copy docker-compose.yml.example to docker-compose.yml and update as needed. See example below: Docker-compose⁠ example:
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"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "80:80/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'
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped
  1. Run docker-compose up -d to build and start pi-hole
  2. Use the Pi-hole web UI to change the DNS settings Interface listening behavior to "Listen on all interfaces, permit all origins", if using Docker's default bridge network setting. (This can also be achieved by setting the environment variable DNSMASQ_LISTENING to all)

Here is an equivalent docker run script⁠.

⁠Overview

A Docker⁠ project to make a lightweight x86 and ARM container with Pi-hole⁠ functionality.

  1. Install docker for your x86-64 system⁠ or ARMv7 system⁠ using those links. Docker-compose⁠ is also recommended.
  2. Use the above quick start example, customize if desired.
  3. Enjoy!

Build Status Docker Stars Docker Pulls

⁠Running Pi-hole Docker

This container uses 2 popular ports, port 53 and port 80, so may conflict with existing applications ports. If you have no other services or docker containers using port 53/80 (if you do, keep reading below for a reverse proxy example), the minimum arguments required to run this container are in the script docker_run.sh⁠

If you're using a Red Hat based distribution with an SELinux Enforcing policy add :z to line with volumes like so:

    -v "$(pwd)/etc-pihole:/etc/pihole:z" \
    -v "$(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d:z" \

Volumes are recommended for persisting data across container re-creations for updating images. The IP lookup variables may not work for everyone, please review their values and hard code IP and IPv6 if necessary.

You can customize where to store persistent data by setting the PIHOLE_BASE environment variable when invoking docker_run.sh (e.g. PIHOLE_BASE=/opt/pihole-storage ./docker_run.sh). If PIHOLE_BASE is not set, files are stored in your current directory when you invoke the script.

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⁠

⁠Environment Variables

There are other environment variables if you want to customize various things inside the docker container:

VariableDefaultValueDescription
TZUTC<Timezone>Set your timezone⁠ to make sure logs rotate at local midnight instead of at UTC midnight.
WEBPASSWORDrandom<Admin password>http://pi.hole/admin⁠ password. Run docker logs pihole | grep random to find your random pass.
FTLCONF_LOCAL_IPV4unset<Host's IP>Set to your server's LAN IP, used by web block modes and lighttpd bind address.
⁠Optional Variables
VariableDefaultValueDescription
PIHOLE_DNS_8.8.8.8;8.8.4.4IPs delimited by ;Upstream DNS server(s) for Pi-hole to forward queries to, separated by a semicolon
(supports non-standard ports with #[port number]) e.g 127.0.0.1#5053;8.8.8.8;8.8.4.4
(supports Docker service names and links⁠ instead of IPs) e.g upstream0;upstream1 where upstream0 and upstream1 are the service names of or links to docker services
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
DNSSECfalse<"true"|"false">Enable DNSSEC support
DNS_BOGUS_PRIVtrue<"true"|"false">Never forward reverse lookups for private ranges
DNS_FQDN_REQUIREDtrue<"true"|"false">Never forward non-FQDNs
REV_SERVERfalse<"true"|"false">Enable DNS conditional forwarding for device name resolution
REV_SERVER_DOMAINunsetNetwork DomainIf conditional forwarding is enabled, set the domain of the local network router
REV_SERVER_TARGETunsetRouter's IPIf conditional forwarding is enabled, set the IP of the local network router
REV_SERVER_CIDRunsetReverse DNSIf conditional forwarding is enabled, set the reverse DNS zone (e.g. 192.168.0.0/24)
DHCP_ACTIVEfalse<"true"|"false">Enable DHCP server. Static DHCP leases can be configured with a custom /etc/dnsmasq.d/04-pihole-static-dhcp.conf
DHCP_STARTunset<Start IP>Start of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
DHCP_ENDunset<End IP>End of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
DHCP_ROUTERunset<Router's IP>Router (gateway) IP address sent by the DHCP server (mandatory if DHCP server is enabled).
DHCP_LEASETIME24<hours>DHCP lease time in hours.
PIHOLE_DOMAINlan<domain>Domain name sent by the DHCP server.
DHCP_IPv6false<"true"|"false">Enable DHCP server IPv6 support (SLAAC + RA).
DHCP_rapid_commitfalse<"true"|"false">Enable DHCPv4 rapid commit (fast address assignment).
VIRTUAL_HOST$FTLCONF_LOCAL_IPV4<Custom Hostname>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
IPv6true<"true"|"false">For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false.
TEMPERATUREUNITc<c|k|f>Set preferred temperature unit to c: Celsius, k: Kelvin, or f Fahrenheit units.
WEBUIBOXEDLAYOUTboxed<boxed|traditional>Use boxed layout (helpful when working on large screens)
QUERY_LOGGINGtrue<"true"|"false">Enable query logging or not.
WEBTHEMEdefault-light<"default-dark"|"default-darker"|"default-light"|"default-auto"|"lcars">User interface theme to use.
WEBPASSWORD_FILEunset<Docker secret path>Set an Admin password using Docker secrets⁠. If WEBPASSWORD is set, WEBPASSWORD_FILE is ignored. If WEBPASSWORD is empty, and WEBPASSWORD_FILE is set to a valid readable file path, then WEBPASSWORD will be set to the contents of WEBPASSWORD_FILE.
⁠Advanced Variables
VariableDefaultValueDescription
INTERFACEunset<NIC>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.
DNSMASQ_LISTENINGunset<local|all|single>local listens on all local subnets, all permits listening on internet origin subnets in addition to local, single listens only on the interface specified.
WEB_PORTunset<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⁠
SKIPGRAVITYONBOOTunset<unset|1>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.
CORS_HOSTSunset<FQDNs delimited by ,>List of domains/subdomains on which CORS is allowed. Wildcards are not supported. Eg: CORS_HOSTS: domain.com,home.domain.com,www.domain.com.
CUSTOM_CACHE_SIZE10000NumberSet the cache size for dnsmasq. Useful for increasing the default cache size or to set it to 0. Note that when DNSSEC is "true", then this setting is ignored.
FTL_CMDno-daemonno-daemon -- <dnsmasq option>Customize the options with which dnsmasq gets started. e.g. no-daemon -- --dns-forward-max 300 to increase max. number of concurrent dns queries on high load setups.
FTLCONF_[SETTING]unsetAs per documentationCustomize pihole-FTL.conf with settings described in the FTLDNS Configuration page⁠. For example, to customize LOCAL_IPV4, ensure you have the FTLCONF_LOCAL_IPV4 environment variable set.
⁠Experimental Variables
VariableDefaultValueDescription
DNSMASQ_USERunset<pihole|root>Allows changing the user that FTLDNS runs as. Default: pihole
PIHOLE_UID999NumberOverrides image's default pihole user id to match a host user id
IMPORTANT: id must not already be in use inside the container!
PIHOLE_GID999NumberOverrides image's default pihole group id to match a host group id
IMPORTANT: id must not already be in use inside the container!
WEB_UID33NumberOverrides image's default www-data user id to match a host user id
IMPORTANT: id must not already be in use inside the container! (Make sure it is different to PIHOLE_UID if you are using that, also)
WEB_GID33NumberOverrides image's default www-data group id to match a host group id
IMPORTANT: id must not already be in use inside the container! (Make sure it is different to PIHOLE_GID if you are using that, also)
WEBLOGS_STDOUT00|10 logs to defined files, 1 redirect access and error logs to stdout

⁠Deprecated environment variables:

While these may still work, they are likely to be removed in a future version. Where applicable, alternative variable names are indicated. Please review the table above for usage of the alternative variables

Docker Environment Var.DescriptionReplaced By
CONDITIONAL_FORWARDINGEnable DNS conditional forwarding for device name resolutionREV_SERVER
CONDITIONAL_FORWARDING_IPIf conditional forwarding is enabled, set the IP of the local network routerREV_SERVER_TARGET
CONDITIONAL_FORWARDING_DOMAINIf conditional forwarding is enabled, set the domain of the local network routerREV_SERVER_DOMAIN
CONDITIONAL_FORWARDING_REVERSEIf conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. 0.168.192.in-addr.arpa)REV_SERVER_CIDR
DNS1Primary upstream DNS provider, default is google DNSPIHOLE_DNS_
DNS2Secondary upstream DNS provider, default is google DNS, no if only one DNS should usedPIHOLE_DNS_
ServerIPSet to your server's LAN IP, used by web block modes and lighttpd bind addressFTLCONF_REPLY_ADDR4
ServerIPv6If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fullyFTLCONF_REPLY_ADDR6
FTLCONF_REPLY_ADDR4Set to your server's LAN IP, used by web block modes and lighttpd bind addressFTLCONF_LOCAL_IPV4
FTLCONF_REPLY_ADDR6If you have a v6 network set to your server's LAN IPv6 to block IPv6 ads fullyFTLCONF_LOCAL_IPV6

To use these env vars in docker run format style them like: -e DNS1=1.1.1.1

Here is a rundown of other arguments for your docker-compose / docker run.

Docker ArgumentsDescription
-p <port>:<port> RecommendedPorts to expose (53, 80, 67), the bare minimum ports required for Pi-holes HTTP and DNS services
--restart=unless-stopped
Recommended
Automatically (re)start your Pi-hole on boot or in the event of a crash
-v $(pwd)/etc-pihole:/etc/pihole
Recommended
Volumes for your Pi-hole configs help persist changes across docker image updates
-v $(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d
Recommended
Volumes for your dnsmasq configs help persist changes across docker image updates
--net=host
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.
--cap-add=NET_ADMIN
Recommended
Commonly added capability for DHCP, see Note on Capabilities⁠ below for other capabilities.
--dns=127.0.0.1
Optional
Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, may fix resolution errors on container restart.
--dns=1.1.1.1
Optional
Sets a backup server of your choosing in case DNSMasq has problems starting
--env-file .env
Optional
File to store environment variables for docker replacing -e key=value settings. Here for convenience

⁠Tips and Tricks

  • A good way to test things are working right is by loading this page: http://pi.hole/admin/⁠
  • How do I set or reset the Web interface Password?⁠
    • docker exec -it pihole_container_name pihole -a -p - then enter your password into the prompt
  • Port conflicts? Stop your server's existing DNS / Web services.
    • Don't forget to stop your services from auto-starting again after you reboot
    • Ubuntu users see below for more detailed information
  • You can map other ports to Pi-hole port 80 using docker's port forwarding like this -p 8080:80 if you are using the default blocking mode. If you are using the legacy IP blocking mode, you should not remap this port.
    • Here is an example of running with nginxproxy/nginx-proxy⁠ (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 nginxproxy/nginx-proxy and you need to set the matching VIRTUAL_HOST for the Pi-hole's container. Please read nginxproxy/nginx-proxy readme for more info if you have trouble.
  • 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".
⁠Installing on Ubuntu or Fedora

Modern releases of Ubuntu (17.10+) and Fedora (33+) include systemd-resolved⁠ which is configured by default to implement a caching DNS stub resolver. This will prevent pi-hole from listening on port 53. The stub resolver should be disabled with: sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf

This will not change the nameserver settings, which point to the stub resolver thus preventing DNS resolution. Change the /etc/resolv.conf symlink to point to /run/systemd/resolve/resolv.conf, which is automatically updated to follow the system's netplan⁠: sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf' After making these changes, you should restart systemd-resolved using systemctl restart systemd-resolved

Once pi-hole is installed, you'll want to configure your clients to use it (see here⁠). If you used the symlink above, your docker host will either use whatever is served by DHCP, or whatever static setting you've configured. If you want to explicitly set your docker host's nameservers you can edit the netplan(s) found at /etc/netplan, then run sudo netplan apply. Example netplan:

network:
    ethernets:
        ens160:
            dhcp4: true
            dhcp4-overrides:
                use-dns: false
            nameservers:
                addresses: [127.0.0.1]
    version: 2

Note that it is also possible to disable systemd-resolved entirely. However, this can cause problems with name resolution in vpns (see bug report⁠). It also disables the functionality of netplan since systemd-resolved is used as the default renderer (see man netplan⁠). If you choose to disable the service, you will need to manually set the nameservers, for example by creating a new /etc/resolv.conf.

Users of older Ubuntu releases (circa 17.04) will need to disable dnsmasq.

⁠Installing on Dokku

@Rikj000 has produced a guide to assist users installing Pi-hole on Dokku⁠

⁠Docker tags and versioning

The primary docker tags are explained in the following table. Click here to see the full list of tags⁠. See GitHub Release notes⁠ to see the specific version of Pi-hole Core, Web, and FTL included in the release.

tagdescription
latestAlways latest release
2022.04Date-based release that can receive bugfix updates
2022.04.1A specific image that will not receive updates
devSimilar to latest, but for the development branch (pushed occasionally)
*betaEarly beta releases of upcoming versions - here be dragons
nightlyLike dev but pushed every night and pulls from the latest development branches of the core Pi-hole components (Pi-hole, AdminLTE, FTL)

⁠Upgrading, Persistence, and Customizations

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. However, mounting these configuration files as read-only should be avoided. Volumes are also important to persist the configuration in case you have removed the Pi-hole container which is a typical docker upgrade pattern.

⁠Upgrading / Reconfiguring

Do not attempt to upgrade (pihole -up) or reconfigure (pihole -r). New images will be released for upgrades, upgrading by replacing your old container with a fresh upgraded image is the 'docker way'. Long-living docker containers are not the docker way since they aim to be portable and reproducible, why not re-create them often! Just to prove you can.

  1. Read the release notes for both this Docker release and the Pi-hole release
    • This will help you avoid common problems due to any known issues with upgrading or newly required arguments or variables
    • We will try to put common break/fixes at the top of this readme too
  2. Download the latest version of the image: docker pull pihole/pihole
  3. Throw away your container: docker rm -f pihole
    • Warning When removing your pihole container you may be stuck without DNS until step 3; docker pull before docker rm -f to avoid DNS interruption OR always have a fallback DNS server configured in DHCP to avoid this problem altogether.
    • If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
  4. Start your container with the newer base image: `docker run pihole/

Tag summary

Content type

Image

Digest

sha256:3488dd88d…

Size

128.1 MB

Last updated

about 4 years ago

docker pull allancoding/pihole-libseccomp2-fix