mirror of
https://github.com/casjaysdevdocker/gitea
synced 2026-06-23 20:01:01 -04:00
🐛 Re-apply resolv.conf in init.d phase to beat Docker's async rewrite 🐛
Docker writes /etc/resolv.conf at container start before PID1 launches, and again asynchronously when the network finishes initializing. The entrypoint's early copy gets overwritten by Docker's second write. Re-applying the custom resolv.conf in __run_precopy (init.d phase) happens after Docker's network setup is complete, so the search . and options ndots:0 settings stick for the full container lifetime. - rootfs/usr/local/etc/docker/init.d/08-gitea.sh: copy custom resolv.conf in __run_precopy rootfs/usr/local/etc/docker/init.d/08-gitea.sh
This commit is contained in:
@@ -287,8 +287,10 @@ __run_precopy() {
|
||||
# Define environment
|
||||
local hostname=${HOSTNAME}
|
||||
[ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck"
|
||||
# Define actions/commands
|
||||
|
||||
# Re-apply custom resolv.conf — Docker rewrites /etc/resolv.conf asynchronously
|
||||
# during container startup, after the entrypoint's initial copy. Applying it here
|
||||
# (in the init.d phase) ensures it takes effect after Docker finishes network setup.
|
||||
[ -f "/usr/local/etc/resolv.conf" ] && cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true
|
||||
# allow custom functions
|
||||
if builtin type -t __run_precopy_local | grep -q 'function'; then __run_precopy_local; fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user