forked from RoushTech/docker
chpst -u app drops supplementary groups, breaking Docker socket and session access #22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
/etc/services.d/frankenphp/runstarts the server withchpst -u app, which sets onlyuid and primary gid — it discards supplementary groups. Anything that works by adding
appto a group is therefore a silent no-op.Observed on
matthewbaggett/frankenphp:8.5(
sha256:793e376186016d74ee14c0cefc6c6908c3c6c1ead2b20305b92b4148b84b29f7):Why it matters
This is the root cause behind several separate-looking failures:
The Docker Engine API is unreachable from PHP. An app that bind-mounts
/var/run/docker.sockand addsappto the socket's owning group at entrypoint time(the portable way to do it, since the gid is 0 on Docker Desktop and the
dockergid ona Linux host) gets nothing — the group is dropped before the server starts:
Sessions fail — see the companion issue about
/var/lib/php-zts/session, which isroot:frankenphp 0770. Group membership cannot fix it while this stands.Suggested fix
Use something that calls
initgroups():Either keeps supplementary groups, at which point group-based fixes start working as
written and no downstream image needs a workaround.
For contrast,
matthewbaggett/php:8.5(nginx + php-fpm) is unaffected: php-fpm drops toappviainitgroups(), so supplementary groups survive there.