docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.77k stars 2k forks source link

Missing socks dir in image #1444

Closed owngr closed 7 months ago

owngr commented 9 months ago

Hello there,

Image impacted: 8.1-apache-bookworm

We run your docker images as non root and recently noticed that it isn't possible to run apache2ctl anymore. I get the following error when trying to run any apache2ctl command:

apache2ctl -k graceful
chown: changing ownership of '/var/run/apache2/socks.6lWmhC0DVq': Operation not permitted

apache2ctl has this line of code in it

[ ! -d ${APACHE_RUN_DIR:-/var/run/apache2}/socks ] && mkdir_chown ${APACHE_RUN_USER:-www-data} ${APACHE_RUN_DIR:-/var/run/apache2}/socks

The problem seems to be that the /var/run/socks folder doesn't exist in your image and then apache2ctl needs root access to create it.

The problem seems to be only in the bookworm version, the bullseye version works as expected.

I think creating the folder here would solve the problem https://github.com/docker-library/php/blob/09e2bdf86264c8921b3adbf02d015b4dcc9cf6b6/8.1/bookworm/apache/Dockerfile#L67

tianon commented 7 months ago

Ah, looks like this changed in/due to https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 -- yeah, I guess we probably need to pre-create it with appropriate permissions as well. :disappointed:

I'll work on a PR.

tianon commented 7 months ago

I think #1473 should fix your issue :crossed_fingers: