User:X-Savitar/Sandbox/php-and-docker

To run a PHP application in a Docker container, run the following command; docker run -d --name <container-name> -p 8080:80 -v /path/to/your/php/files:/var/www/html/ php:apache

Parameters:

  • -d - for detached mode, to run the container in the background.

Re-run container after creation

To start/stop your container after running the command above, just use;

 docker start <container-name> 

or

 docker stop <container-name> 

NOTE: The assumption here is that the application running doesn't need a database. Just a simple PHP application to parser and render files.