Docker and PHP: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:
   
   
  COPY index.php /var/www/html/
  COPY index.php /var/www/html/
To build the image:
docker build -t phpinfo:latest .
To run the image:
docker run --rm -p 8080:80 phpinfo

Revision as of 14:18, 9 February 2020

Basic PHP Dockerfile

Build an image and copy in a PHP file:

FROM php:7.2-apache-stretch

COPY index.php /var/www/html/

To build the image:

docker build -t phpinfo:latest .

To run the image:

docker run --rm -p 8080:80 phpinfo