I'm currently developing a RESTful API with the Slim framework and I'm trying to run it on a docker container. The problem, however, is that the script runs only once and than automatically exits from docker with the exit code 0, i.e. it catches the first http request for the index.php page, returns it and then it exits.
I'm sure, there must be a way to run apache on a container, so that every time I make a request for a specific URL(like localhost:8080/api/something) on my local browser, so that the apache server that is running in the container would handle those requests. However, since I didn't have any previous experience with docker, I'm currently not able to solve this.
Here's my Dockerfile:
FROM php:7.0-cli
COPY . /usr/src/my_app
WORKDIR /usr/src/my_app/public
CMD [ "php", "./index.php" ]
Here's my Docker-compose file:
version: '2'
services:
app:
build: ./app
volumes:
- ./app:/usr/src/app
ports:
- 5001:80
Can someone tell my how to change my Dockerfile or Docker-compose file, so that the apache server does not exits after the first requests, but it still runs and listens for other requests.
Thank you in advance!