Script para criar um container com php e apache

Corre

sudo sh ./docker-container-php.sh container-name 8080

Roteiro

#!/bin/bash

CONTAINER_NAME
=$1
HOST_PORT
=$2
HOST_DIR
=$(pwd)

echo
'### Creating docker container: ' $CONTAINER_NAME
sudo docker run
-d -p $HOST_PORT:80 --name $CONTAINER_NAME -v $HOST_DIR:/var/www/html php:7.0-apache

echo
'### Activating mod-rewrite'
sudo docker
exec $CONTAINER_NAME a2enmod rewrite

echo
'### Restarting apache 2'
sudo docker
exec $CONTAINER_NAME service apache2 restart

echo
'n### Restart container ' $CONTAINER_NAME
sudo docker restart $CONTAINER_NAME