Fix coturn crash: image runs as nobody, can't create pidfile

The coturn/coturn:latest image sets USER nobody:nogroup. On startup,
turnserver tries to create /var/run/turnserver.pid which nobody can't
write to, causing an immediate crash (the 2.2s "Error" in compose).

Fix: add user: root to the coturn service. Since we already use
network_mode: host, the container has broad host access anyway.

Also adds DETECT_EXTERNAL_IP=yes which is the image's native way
to auto-detect and set --external-ip, replacing our shell script.

https://claude.ai/code/session_01Vm6NLaQuzM4VosAotqS1q8
This commit is contained in:
Claude
2026-02-24 00:27:46 +00:00
parent 8a14b3eded
commit f71bec27e5
+6 -2
View File
@@ -82,8 +82,12 @@ services:
image: coturn/coturn:latest
container_name: easy-asterisk-coturn
network_mode: host
# Uses the image's native docker-entrypoint.sh (no shell override)
# which prepends 'turnserver' when first arg starts with '-'
# The coturn image runs as nobody:nogroup by default, which cannot
# create /var/run/turnserver.pid. Run as root to avoid this.
user: root
environment:
# Image-native external IP detection (adds --external-ip automatically)
- DETECT_EXTERNAL_IP=${DETECT_EXTERNAL_IP:-yes}
command:
- -n
- --listening-port=3478