thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
780 stars 138 forks source link

ALERT: [pool www] user has not been defined #206

Open michalhlavka opened 4 years ago

michalhlavka commented 4 years ago

Hi, I am starting container from FROM thecodingmachine/php:7.4-v3-fpm and getting

php_1       | [07-Jul-2020 13:22:56] ALERT: [pool www] user has not been defined
php_1       | [07-Jul-2020 13:22:56] ALERT: [pool www] user has not been defined
php_1       | [07-Jul-2020 13:22:56] ERROR: failed to post process the configuration
php_1       | [07-Jul-2020 13:22:56] ERROR: failed to post process the configuration
php_1       | [07-Jul-2020 13:22:56] ERROR: FPM initialization failed
php_1       | [07-Jul-2020 13:22:56] ERROR: FPM initialization failed

At the local machine, everything is right but on the server, it's failing.

Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

4.19.0-9-amd64

Any advice? One week I am trying to figure it out, what is wrong. Thank you.

DepkaCZ commented 3 years ago

The user is really not defined in /etc/php/7.4/fpm/pool.d/www.conf this also applies to 7.1 images as well please fix it.

Temporary solution is to get the /etc/php/7.4/fpm/pool.d/www.conf out of the container, modify it by uncommenting the user = www-data line and then overwrite it e.g. in docker compose

DepkaCZ commented 3 years ago

Hmm, my previous post is only partial solution as I'm getting error when trying to install new composer packages :

Cannot create cache directory /home/docker/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache

I've tried to change group/user to docker/docker as stated in readme but without any luck :/

beejaz commented 3 years ago

We have the same error since recently. Trying to load thecodingmachine/php:7.4-v3-slim-fpm on a fresh computer without previous installation/cache gives this: php_1 | [01-Oct-2020 19:28:49] ALERT: [pool www] user has not been defined php_1 | [01-Oct-2020 19:28:49] ALERT: [pool www] user has not been defined php_1 | [01-Oct-2020 19:28:49] ERROR: failed to post process the configuration php_1 | [01-Oct-2020 19:28:49] ERROR: failed to post process the configuration php_1 | [01-Oct-2020 19:28:49] ERROR: FPM initialization failed php_1 | [01-Oct-2020 19:28:49] ERROR: FPM initialization failed

DepkaCZ commented 3 years ago

I've solved it by disabling WSL support in Docker for windows

beejaz commented 3 years ago

Thats strange. I get this error on a Linux host that has nothing to do with Docker for Windows also.

moufmouf commented 3 years ago

Hey guys,

Could you explain me how to reproduce this problem (on a Linux host if possible)?

Because right now, I don't know how to generate this error.

$ docker run thecodingmachine/php:7.4-v3-fpm
[05-Oct-2020 08:17:27] NOTICE: fpm is running, pid 3338
[05-Oct-2020 08:17:27] NOTICE: ready to handle connections
[05-Oct-2020 08:17:27] NOTICE: systemd monitor interval set to 10000ms

I'm looking at a way to add a breaking test before trying to solve this issue.

beejaz commented 3 years ago

Hi @moufmouf

It worked on all my hosts that has previous cache (or something) from your image even if i choose --no-cache option. But when I use a fresh new VM with Linux (Ubuntu) it didnt work.

I tried to replicate this, again, today on a fresh machine and now it works for me. I will test on one of the old hosts that didnt work. Ill get back.

michalhlavka commented 3 years ago

With docker run thecodingmachine/php:7.4-v3-fpm everything it's ok.

But when I use docker-compose along with nginx, it's again

[06-Oct-2020 12:37:39] ALERT: [pool www] user has not been defined
php_1       | [06-Oct-2020 12:37:39] ALERT: [pool www] user has not been defined
php_1       | [06-Oct-2020 12:37:39] ERROR: failed to post process the configuration
php_1       | [06-Oct-2020 12:37:39] ERROR: failed to post process the configuration
php_1       | [06-Oct-2020 12:37:39] ERROR: FPM initialization failed
php_1       | [06-Oct-2020 12:37:39] ERROR: FPM initialization failed

docker-compose

services:
  nginx:
    build:
      context: .
      dockerfile: ./.docker/nginx/Dockerfile
    volumes:
      - ./:/var/www/html/
      - ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./.docker/nginx/sites/:/etc/nginx/sites-available
      - ./.docker/nginx/conf.d/:/etc/nginx/conf.d
    depends_on:
      - php
    ports:
      - "80:80"
      - "443:443"
  php:
    build:
      context: .
      dockerfile: ./.docker/php/Dockerfile
    volumes:
      - ./:/var/www/html
    environment:
      PHP_EXTENSION_XDEBUG: 0
      PHP_EXTENSION_PGSQL: 1
      PHP_EXTENSION_PDO_PGSQL: 1
      PHP_EXTENSION_MYSQLI: 0
      STARTUP_COMMAND_1: chown docker /proc/self/fd/{1,2} // this should be fix, but it's not working

PHP Dockerfile

FROM thecodingmachine/php:7.4-v3-fpm

COPY ./ /var/www/html/

WORKDIR /var/www/html/

CMD ["php-fpm"]

EXPOSE 9000

Nginx Dockerfile

FROM nginx:alpine
COPY ./ /var/www/html/
CMD ["nginx"]

EXPOSE 80 443
mbrowngold commented 3 years ago

I've solved it by disabling WSL support in Docker for windows

This solved it for me as well.

beejaz commented 3 years ago

This started to work out of nowhere for me 👍 Both on Linux hosts and WSL2 host with docker for windows

DepkaCZ commented 3 years ago

Still not working for me :/

On Thu, Oct 15, 2020 at 8:20 PM Björn notifications@github.com wrote:

This started to work out of nowhere for me 👍 Both on Linux hosts and WSL2 host with docker for windows

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thecodingmachine/docker-images-php/issues/206#issuecomment-709505974, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAOTQVIJZ75I3O67EM3RXTSK44O5ANCNFSM4OS2GVZQ .

racinmat commented 3 years ago

Happening to me too, windows 10, using WSL.

DepkaCZ commented 3 years ago

Arent you trying to run the docker compose from windows shell ? I found that you must run it from wsl shell

čt 8. 4. 2021 v 19:14 odesílatel Matěj Račinský @.***> napsal:

Happening to me too, windows 10, using WSL.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thecodingmachine/docker-images-php/issues/206#issuecomment-815996085, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAOTQW75DN5HCNTDGZHVQLTHXP7TANCNFSM4OS2GVZQ .

racinmat commented 3 years ago

Thanks, I'll try it. Unfortunately, running it from wsl shell causes me https://github.com/docker/compose/issues/7899

lordisp commented 3 years ago

Arent you trying to run the docker compose from windows shell ? I found that you must run it from wsl shell

seams that did it. however the cause for this would be good to understand

leekung commented 3 years ago

Here is what I fix this issue I replace all 3 pools with this

in docker-compose file

  php8:
    image: "thecodingmachine/php:8.0-v4-fpm-node14"
    volumes:
      - ./htdocs:/var/www/htdocs
      - ./docker.conf:/etc/php/8.0/fpm/pool.d/docker.conf
      - ./www.conf:/etc/php/8.0/fpm/pool.d/www.conf
      - ./zz-docker.conf:/etc/php/8.0/fpm/pool.d/zz-docker.conf

www.conf and zz-docker.conf is empty file docker.conf is custom pool with user, group defined. example

[global]
daemonize = no

[docker]
user = docker
group = docker
listen = 9000
listen.owner = root
listen.group = docker
access.log = /proc/self/fd/2
catch_workers_output = yes
decorate_workers_output = no
csaeum commented 3 years ago

Hello I have the problem too.

[10-Jul-2021 08:58:12] ALERT: [pool www] user has not been defined [10-Jul-2021 08:58:12] ALERT: [pool www] user has not been defined [10-Jul-2021 08:58:12] ERROR: failed to post process the configuration [10-Jul-2021 08:58:12] ERROR: failed to post process the configuration [10-Jul-2021 08:58:12] ERROR: FPM initialization failed [10-Jul-2021 08:58:12] ERROR: FPM initialization failed

My server runs under Ubuntu 20.04.2 LTS, only Docker and Docker-Compose and SSH are installed.

I've tried several options and suggestions on the net.

csaeum commented 3 years ago

Here is what I fix this issue I replace all 3 pools with this

in docker-compose file

  php8:
    image: "thecodingmachine/php:8.0-v4-fpm-node14"
    volumes:
      - ./htdocs:/var/www/htdocs
      - ./docker.conf:/etc/php/8.0/fpm/pool.d/docker.conf
      - ./www.conf:/etc/php/8.0/fpm/pool.d/www.conf
      - ./zz-docker.conf:/etc/php/8.0/fpm/pool.d/zz-docker.conf

www.conf and zz-docker.conf is empty file docker.conf is custom pool with user, group defined. example

[global]
daemonize = no

[docker]
user = docker
group = docker
listen = 9000
listen.owner = root
listen.group = docker
access.log = /proc/self/fd/2
catch_workers_output = yes
decorate_workers_output = no

Today I checked again whether it could be done. I also tried that from @leekung . Unfortunately, I just can't get it to work.

The developers don't seem to care about the issues at the moment because it has been open for a long time.

Who can recommend an alternative Docker image with phpFPM and Crontab.

leekung commented 3 years ago

Here is what I fix this issue I replace all 3 pools with this in docker-compose file

  php8:
    image: "thecodingmachine/php:8.0-v4-fpm-node14"
    volumes:
      - ./htdocs:/var/www/htdocs
      - ./docker.conf:/etc/php/8.0/fpm/pool.d/docker.conf
      - ./www.conf:/etc/php/8.0/fpm/pool.d/www.conf
      - ./zz-docker.conf:/etc/php/8.0/fpm/pool.d/zz-docker.conf

www.conf and zz-docker.conf is empty file docker.conf is custom pool with user, group defined. example

[global]
daemonize = no

[docker]
user = docker
group = docker
listen = 9000
listen.owner = root
listen.group = docker
access.log = /proc/self/fd/2
catch_workers_output = yes
decorate_workers_output = no

Today I checked again whether it could be done. I also tried that from @leekung . Unfortunately, I just can't get it to work.

The developers don't seem to care about the issues at the moment because it has been open for a long time.

Who can recommend an alternative Docker image with phpFPM and Crontab.

use the following https://www.github.com/webdevops/Dockerfile

csaeum commented 2 years ago

use the following https://www.github.com/webdevops/Dockerfile Thanks @leekung However, this Docker image has no integrated cron service

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please update it if any action still required.

csaeum commented 2 years ago

This should not be closed yet. Since it still affects some

csaeum commented 2 years ago

How does it go on here? Not much happening here lately?

mistraloz commented 2 years ago

Yes yes... it's difficult currently. I should have more time soon. In addition, if someone would like help us to manage thoses images, s/he can contact me (we will continue to support but sometime we have less time so someone in backup maybe helpful).

alexmaurer-madis commented 2 years ago

I had similar issue and found why.

The message was the following :

ALERT: [pool www] user has not been defined
ALERT: [pool www] user has not been defined
ERROR: failed to post process the configuration
ERROR: failed to post process the configuration
ERROR: FPM initialization failed
ERROR: FPM initialization failed

My container was created with Portainer and the user field under Command and Logging has been set automatically to "root" instead of "nobody".

The user has already been specified in the Dockerfile with USER nobody

So you can leave the field under portainer empty, it will be automatically assigned to nobody

Or run your container with --user=nobody (i didn't try this method)

jsuos commented 2 years ago

Here is what I fix this issue I replace all 3 pools with this

in docker-compose file

  php8:
    image: "thecodingmachine/php:8.0-v4-fpm-node14"
    volumes:
      - ./htdocs:/var/www/htdocs
      - ./docker.conf:/etc/php/8.0/fpm/pool.d/docker.conf
      - ./www.conf:/etc/php/8.0/fpm/pool.d/www.conf
      - ./zz-docker.conf:/etc/php/8.0/fpm/pool.d/zz-docker.conf

www.conf and zz-docker.conf is empty file docker.conf is custom pool with user, group defined. example

[global]
daemonize = no

[docker]
user = docker
group = docker
listen = 9000
listen.owner = root
listen.group = docker
access.log = /proc/self/fd/2
catch_workers_output = yes
decorate_workers_output = no

Bro, you saved me after hours of becoming more and more suicidal.

<3

RobertoTorino commented 1 year ago

got the exact same error, I used a script to build the dockercontainer turned out I accidentally left --user=root in my build command...

huntson commented 1 month ago

I had similar issue and found why.

The message was the following :

ALERT: [pool www] user has not been defined
ALERT: [pool www] user has not been defined
ERROR: failed to post process the configuration
ERROR: failed to post process the configuration
ERROR: FPM initialization failed
ERROR: FPM initialization failed

My container was created with Portainer and the user field under Command and Logging has been set automatically to "root" instead of "nobody".

The user has already been specified in the Dockerfile with USER nobody

So you can leave the field under portainer empty, it will be automatically assigned to nobody

Or run your container with --user=nobody (i didn't try this method)

Where does this change actually get made?