I want to automatically run the PHP script of the queue consumer after the docker container is started. How should I write this Dockerfile? How to ensure that if this php script hangs, it can be automatically restarted?
Or is there any better solution?
If the container only has queue consumers and no other services, then directly use docker’s restart mechanism and specify
--restart=always
when starting.If you want to put multiple services in one container, use supervisor.