mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-21 06:56:53 +02:00
change UID / GID for www-data and pihole user.
When mounting volumes, specific rights may be needed to write on mounted volumes on the host. Signed-off-by: edgd1er <edgd1er@hotmail.com>
This commit is contained in:
parent
0a20ef8955
commit
2cec4fa719
|
@ -26,6 +26,10 @@ services:
|
|||
- "80:80/tcp"
|
||||
environment:
|
||||
TZ: 'America/Chicago'
|
||||
WEB_UID: '1001'
|
||||
WEB_GID: '1000'
|
||||
PIHOLE_UID: '1001'
|
||||
PIHOLE_GID: '1000'
|
||||
# WEBPASSWORD: 'set a secure password here or it will be random'
|
||||
# Volumes store your data between container upgrades
|
||||
volumes:
|
||||
|
@ -128,6 +132,10 @@ There are other environment variables if you want to customize various things in
|
|||
| `CORS_HOSTS` | unset | `<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_SIZE` | `10000` | Number | Set 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.
|
||||
| `FTLCONF_[SETTING]` | unset | As per documentation | Customize pihole-FTL.conf with settings described in the [FTLDNS Configuration page](https://docs.pi-hole.net/ftldns/configfile/). For example, to customize REPLY_ADDR6, ensure you have the `FTLCONF_REPLY_ADDR6` environment variable set.
|
||||
| PIHOLE_UID | debian system value | Number | Overrides image's default pihole user id to match a host user id |
|
||||
| PIHOLE_GID | debian system value | Number | Overrides image's default pihole group id to match a host group id |
|
||||
| WEB_UID | debian system value | Number | Overrides image's default www-data user id to match a host user id |
|
||||
| WEB_GID | debian system value | Number | Overrides image's default www-data group id to match a host group id |
|
||||
|
||||
### Experimental Variables
|
||||
| Variable | Default | Value | Description |
|
||||
|
|
37
s6/debian-root/etc/cont-init.d/05-changer-uid-gid.sh
Normal file
37
s6/debian-root/etc/cont-init.d/05-changer-uid-gid.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
set -e
|
||||
|
||||
modifyUser()
|
||||
{
|
||||
declare username=${1:-} newId=${2:-}
|
||||
[[ -z ${username} || -z ${newId} ]] && return
|
||||
|
||||
local currentId=$(id -u ${username})
|
||||
[[ ${currentId} -eq ${newId} ]] && return
|
||||
|
||||
echo "user ${username} ${currentId} => ${newId}"
|
||||
usermod -o -u ${newId} ${username}
|
||||
|
||||
find / -user ${currentId} -print0 2> /dev/null | \
|
||||
xargs -0 -n1 chown -h ${username} 2> /dev/null
|
||||
}
|
||||
|
||||
modifyGroup()
|
||||
{
|
||||
declare groupname=${1:-} newId=${2:-}
|
||||
[[ -z ${groupname} || -z ${newId} ]] && return
|
||||
|
||||
local currentId=$(id -g ${groupname})
|
||||
[[ ${currentId} -eq ${newId} ]] && return
|
||||
|
||||
echo "group ${groupname} ${currentId} => ${newId}"
|
||||
groupmod -o -g ${newId} ${groupname}
|
||||
|
||||
find / -group ${currentId} -print0 2> /dev/null | \
|
||||
xargs -0 -n1 chgrp -h ${groupname} 2> /dev/null
|
||||
}
|
||||
|
||||
modifyUser www-data ${WEB_UID}
|
||||
modifyGroup www-data ${WEB_GID}
|
||||
modifyUser pihole ${PIHOLE_UID}
|
||||
modifyGroup pihole ${PIHOLE_GID}
|
Loading…
Reference in New Issue
Block a user