Docker CMD Command Runs Many Times

Hi. I’m testing the Platform, but I’m founding some errors when building with Docker.
Basically, it’s an Application where starts an PHP-FPM and NGINX in Dockerfile.

Well, what can I say? “In my machine works” :sweat_smile:

So, here we go with the main files:

My render.yaml

  - type: web
    name: test-nginx
    env: docker
    region: oregon
    plan: free
    branch: main
    - key: PORT
      value: 8000

My Dockerfile

FROM php:${PHP_VERSION:-8.2}-fpm-alpine

# > Install Dependencies
RUN apk update && apk add nginx openrc

RUN rm -rf /var/lib/apt/lists/*

RUN mkdir /run/openrc && \
    touch /run/openrc/softlevel
# < Install Dependencies

# > Add NGINX Configuration
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
RUN nginx -t
# < Add NGINX Configuration

# > Add PHP-FPM Files
COPY . /app
# < Add PHP-FPM Files

# > Configure Start Shell Script
RUN chmod +x ./

CMD ["./"]
# < Configure Start Shell Script



openrc &> /dev/null
rc-service nginx start &> /dev/null
php-fpm -D
echo " - Started"

Well, when I try to build on Render, the build starts to build the Image and run the container (As expected.) But, after the container is running, and the CMD Script is started, something strange happens.
Basically, the Start Script run many times, and after a time, the build is failed.

Hi there,

I’m not a PHP expert, but I expect it’s the way you’re starting your service.

The Render Laravel example uses the richarvey/nginx-php-fpm Docker image as it’s base. Which also uses a, although admittedly, that seems to be doing a lot more stuff:

Where they call php-fpm, (source) they explicitly use the --nodaemonize, where I see you use -D / --daemonize. Maybe having the process in the foreground might help here?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.