Download and install Docker (https://www.docker.com/community-edition#/download).
docker build --rm -t phpgettingstarted/cli -f Dockerfile.cli .
docker run --rm -it --name my-php-cli phpgettingstarted/cli
Pro Tip: Type exit
to get out of the CLI. Or just press ctrl
+ d
.
docker build -t phpgettingstarted/php-apache -f Dockerfile.apache .
docker run --rm -d --name my-php-apache -p 8080:80 -v "$PWD/src":/var/www/html phpgettingstarted/php-apache
Edit the index.php
file in the /src
folder to see the changes.
To stop the container:
docker stop my-php-apache