I am attempting to create a Docker container using the official PHP 7.4 ZTS image without making any modifications. However, when I start the container, it immediately stops as if the entrypoint is incorrect.
My Dockerfile contains the following content:
FROM php:7.4-zts-alpine
This is the result when I run docker compose up.
I have tried using other official ZTS images, but they also do not work.
>Solution :
If you put tty: true in the docker-compose.yml, you will be able to keep the container running. You can also do this by using the -t flag in the docker command.
The reason FPM doesn’t require it to keep the container running is that FPM is the entrypoint.
With ZTS, bash is the entrypoint — So, once you add a tty: true to the container, bash will be able to create interactive session and the container will (or at least should be) started with bash as the entrypoint.
