additional | ||
compose | ||
dockerfiles | ||
.gitignore | ||
README.md |
EnvDev Dockerfiles
Web Developement Environment (Apache, PHP, MariaDB, ...)
List
- HTTPd
- PHP-FPM
- MariaDB
- Redis
- MailCatcher
- MailDev
- PHP-Cli
Docker Engine
Install
Mac: https://docs.docker.com/docker-for-mac/install/
Windows: https://docs.docker.com/docker-for-windows/install/
Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/
Docker compose
https://github.com/docker/compose/releases
Usage
Start with a docker-compose file (See sample).
We hope you have define a workspace path
Linux: /home/<user>/workspace
Windows: C:\<user>\worspace
Always go in <workspace>/devcontainer
to execute docker-compose command.
Launch services (first time build)
docker-compose up -d
Delete service : docker-compose rm <container_name>
Prune all: docker-compose down
Start and stop
docker-compose start
docker-compose stop
Viewing log
docker-compose logs -f
docker-compose logs <container_name>
View running container
docker-compose ps
Update or Re-create base image
Specific container usage
PHP Cli
Work in your vhosts to execute some command in php
docker-compose exec -u fpm <container_name>
To avoid permissions problem
Update composer or an admin command
docker-compose exec <container_name>
PHP-FPM & Apache vhosts
# Redirect to local php-fpm if mod_php is not available
<IfModule !mod_php7.c>
<IfModule proxy_fcgi_module>
# Enable http authorization headers
<IfModule setenvif_module>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
SetHandler "proxy:fcgi://fpm70/:9000
</FilesMatch>
<FilesMatch ".+\.phps$">
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
Require all denied
</FilesMatch>
</IfModule>
</IfModule>
Database
Database files are store in <workspace>/database
.
Even if you delete your container date are preserved.
Read the doc official MariaDB: https://hub.docker.com/_/mariadb/
HTTPd
Additional
Ip Address
See all ip addresses in one command
docker inspect --format='{{.Name}} - {{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
ctop
Get ctop on github
sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.1/ctop-0.7.1-linux-amd64 -O /usr/local/bin/ctop
sudo chmod +x /usr/local/bin/ctop