Public Repository

Last pushed: a year ago
Short Description
apache + php + vsftpd + postfix
Full Description

#!/bin/bash

#doc parametrs---------------------------------------------------------------------------------
image=alienw8/php-5.6-apache-zts:interactive

#1 info and net--------------------------------------------------------------------------------
docName=<<docname>>
docNet=<<docnet>>
docIp=<<docIP>>
DBaddr=<<docDBAddr>>
DNS_NAME=$docName.<<docDomain>>

#2 resource parametrs--------------------------------------------------------------------------
cpu=200 # % use ( val = 200 this 200/10 = 20%)
memRamMin=1024M
memRamMax=1024M

#3 dir parametrs-------------------------------------------------------------------------------
dataDir=/opt/docker/$docName/data
logDir=/opt/docker/$docName/logs
configDir=/opt/docker/$docName/configs/apache2
phpIni=/opt/docker/$docName/configs/php.ini

#FTP------------------------------------------------------------------------------------------
USERSYS=ADMIN
USERPASS=<<pass>>
PASV_ADDR=$docIp
PASV_MIN_PORT=10000
PASV_MAX_PORT=11000

#MAIL-----------------------------------------------------------------------------------------
MAIL_USER=<<who send mail out container>>
status=0

for arg in $(/usr/bin/docker ps -a | grep $docName)
do
if [ -n $arg ]
then
status=1
break
fi
done

case "$1" in

start)
if [ $status -eq 1 ]
then
echo -e "$docName is started \n"
else
docker run --rm \
--net=$docNet \
--ip=$docIp \
--name $docName \
--cpu-shares=$cpu \
--memory=$memRamMax \
--memory-reservation=$memRamMin \
--add-host=dbserver:$DBaddr \
--add-host=$docName:$docIp \
--add-host=$DNS_NAME:$docIp \
-v $configDir:/etc/apache2 \
-v $dataDir:/var/www \
-v $logDir:/var/log/apache2 \
-v $phpIni:/usr/local/etc/php/php.ini \
-e USERSYS=$USERSYS \
-e USERPASS=$USERPASS \
-e PASV_ADDR=$PASV_ADDR \
-e PASV_MIN_PORT=$PASV_MIN_PORT \
-e PASV_MAX_PORT=$PASV_MAX_PORT \
-e DNS_NAME=$DNS_NAME \
-e MAIL_USER=$MAIL_USER \
-v /etc/localtime:/etc/localtime:ro \
$image
fi
;;

stop)
if [ $status -eq 0 ]
then
echo -e "$docName is down \n"
else
/usr/bin/docker rm -f $docName
echo -e "$docName shutdown [ OK ] \n"
fi
;;

status)
if [ $status -eq 0 ]
then
echo -e "$docName is down \n"
else
echo -e "$docName is work \n"
fi
;;

esac

exit 0

Docker Pull Command
Owner
alienw8