Docker and PHP

From Rixort Wiki
Revision as of 18:48, 20 February 2020 by Paul (Sọ̀rọ̀ | contribs)
Jump to navigation Jump to search

Run a basic PHP Docker image

docker run php:7.3-apache-stretch php --version

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