mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +00:00
Use ip route to determine IP
This commit is contained in:
@@ -3,7 +3,7 @@ docker build -f alpine.docker -t diginc/pi-hole:alpine .
|
|||||||
docker tag diginc/pi-hole:alpine diginc/pi-hole:latest
|
docker tag diginc/pi-hole:alpine diginc/pi-hole:latest
|
||||||
docker build -f debian.docker -t diginc/pi-hole:debian .
|
docker build -f debian.docker -t diginc/pi-hole:debian .
|
||||||
|
|
||||||
IP=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
|
IP=$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')
|
||||||
|
|
||||||
# Alternative ports to not conflict with my real instance
|
# Alternative ports to not conflict with my real instance
|
||||||
# shellcheck disable=SC2068
|
# shellcheck disable=SC2068
|
||||||
@@ -15,4 +15,3 @@ docker run -it --rm --cap-add=NET_ADMIN \
|
|||||||
-e VIRTUAL_HOST='pihole.diginc.lan:5080' \
|
-e VIRTUAL_HOST='pihole.diginc.lan:5080' \
|
||||||
$@ \
|
$@ \
|
||||||
diginc/pi-hole:"${image:-alpine}"
|
diginc/pi-hole:"${image:-alpine}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
IMAGE=${1:-'diginc/pi-hole:alpine'}
|
IMAGE=${1:-'diginc/pi-hole:alpine'}
|
||||||
NIC=${2:-'eth0'}
|
IP=$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')
|
||||||
IP=$(ip addr show "$NIC" | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
|
|
||||||
|
|
||||||
# Default ports + daemonized docker container
|
# Default ports + daemonized docker container
|
||||||
docker run -p 53:53/tcp -p 53:53/udp -p 80:80 \
|
docker run -p 53:53/tcp -p 53:53/udp -p 80:80 \
|
||||||
|
|||||||
Reference in New Issue
Block a user