PHP Docker container doesn`t start with compose file without versionnumber and "-fpm"

Hello together,

ich just built a docker container with compose file like at the end of this text as part with two other docker containers.
All are working but just if “image:” is " php:8.2-fpm".
If it is “php:8.2” it doesnt work. and also if it is “php:latest”.
The container exits immediately.

Why is it not possible to use it without versionnumber and “-fpm”?

How could i use it with “php:latest”?

I cant get infos with docker logs or journalctl if the container isnt running.

php-cgi:
    image: php:latest
    container_name: php-cgi-container
    ports:
      - 8900
    volumes:
      - ./www:/var/www/html
    depends_on:
      - mysql

That is not true, but php:latest is a command line php variant. It won’t run in the background. Check the official image description for more details about tags

https://hub.docker.com/_/php

If you want the latest PHP FPM, just use php:fpm, but it is really not recommended using the latest image. Always set the version number otherwise you will be surprised when your config doesn’t work a week later or on another machine when latest is a different version.