Simple PHP app using Docker compose
UPDATED TO Compose V3
Using offical images from Docker
With some PHP extension.
Folder | Server | PHP | Database |
---|---|---|---|
apache_ubuntu | Apache2 | apache module | Mysql, Postgres |
nginx_ubuntu | NGINX | PHP FastCGI | Mysql, Postgres |
nginx_alpine | NGINX | PHP FastCGI | Postgres |
docker\DOCKER_FILE_CONTEXT
: contains dockerfile for server (Apache or PHP-FPM)docker\.env
: contains variable for docker-compose file (php version, hostname, database user/pass, exposed ports)docker\MAIN.conf
: example of nginx reverse proxy config file. It should be inhttp
contex of nginx configurationdocker\php.ini
: PHP config file. with xdebug supportdocker\mysql.cnf
: Mysql config filedocker\server.conf
: Apache or Nginx config file
All files in
docker
folder have comments. read them before edit any file
NOTE
database
andlog
folder needs Linux like permisson to work. if you are using Windows or Mac OS, comment out mount points (apache
: line 30,38,51 of docker-compose.yml |nginx
: line 20,39,45,58 of docker-compose.yml)
There is no official Mysql for alpine version. so I did not include it in YAML file
to modify hostname, change
.env
file. for nginx variant, you should changeserver.conf
too
Before run any service, read notice
in docker.dockerfile file.
TODO:
- add more services. e.g. redis
- add datavolume to support windows and Mac
- add production example
- docker swarm
if you encounter any problem, open an issue