jueves, 8 de diciembre de 2016

Simple Http Server with Docker

1. Create a simple php file (index.php)


echo "This is an example"
?>

2. Create Dockerfile with the configurations

FROM php:7.0-apache
COPY src/ /var/www/html/
EXPOSE 80


3. Run de command to build the image in the cuurent directory
docker build -t example .

4. Run the command to expose the app through the port 8080 on the host machine
docker run -p 8080:80 example

5. to mount the volume run the command
docker run -p 8080:80 -v ~/projects/dockerExample/src/:/var/www/html/ example