Docker to run PHP in-built web server on the Ubuntu platform. This is a lightweight docker suitable for quickly testing your PHP files, without using Apache or another web server.
Dockerfile etc are available in github at:
It is recommended that you mount a directory containing your PHP files at /content. It is better not to mount the directory directly at the root folder ( / ) because we have copied an index.php file there. When the docker starts up, you can point your browser to the HTTP URL of the web server. You will see a message "Hello World!" and the current time printed (from our /index.php ). This will be a quick sanity test that the docker was started up successfully.
It is recommended that you run the docker using a command-line like:
docker run -v /home/user/content:/content -p 3363:80 techyugadi/phpwebserver
Replace /home/user/content with a directory where your PHP files are located.
The docker exposes the HTTP port 80. Instead of port 3336, map docker port 80 to any suitable port on the docker host.
You will see PHP web server logs directly on the console, which should be helpful in dev environment.
If you don't want messages on the console, you can add -d option to docker run