Search code examples
phpdockergoogle-cloud-platformfpm

PHP FPM dies every request in Cloud Run


I'm trying to run an example application in Google Cloud Run (Fully managed). Every time I send a request to the instance, I get a 503 Service unavailable.

The logs tell me, the process is restarted every time on the same PID, so the process is dying with every request.

Since I have a very standard image, i'm not sure if there is a mistake I made or a misunderstanding on how the things are working.

Dockerfile

FROM php:7.4-fpm-alpine3.11

RUN sed -i 's/9000/${PORT}/' /usr/local/etc/php-fpm.d/zz-docker.conf

RUN mkdir /var/www/public; echo 'This page works' > /var/www/public/index.php
EXPOSE ${PORT}
CMD ["php-fpm", "-F", "-R"]

Logs: Cloud Run Logs


Solution

  • Currently I am assuming that the error is due to the missing HTTP Server in the fpm container. I followed the tutorial Daniel provided, which works fine for my current use case.