Docker container exits immediately after start

Critical local Docker
972
views
25
votes

My Docker container built from a PHP-FPM image exits immediately after docker run. The logs show no error and the exit code is 0.

The issue is that the container runs the entrypoint command and then exits because there's no long-running process. PHP-FPM needs to be started in the foreground.

A
Admin User
Jul 28, 2026

Solutions

1
25
A
Admin User Jul 28, 2026

Ensure the CMD or ENTRYPOINT starts PHP-FPM in the foreground using php-fpm -F or php-fpm --nodaemonize.

CMD ['php-fpm', '-F']
# or in docker-compose:
command: php-fpm -F

Have a solution to share?

Sign in to submit a solution