- git clone/copy to project directory
cp env.example .env
- optionally fill in UID and GID for user of mysql container, so the bind volume will not be owned by root
- optionally exclude lnmp-starter .gitignore in your git project
docker-compose up -d
NGINX - Pitfalls and Common Mistakes
# allocate php.ini
php --ini
# list php module
php -m
# phpinfo() from cmd
php -i
# allocate php-fpm.conf (man php-fpm)
php-fpm -tt
Though user
directive, which set the user of FPM processes
is mandatory for php-fpm. It's used for php-fpm as a service.
By execute php-fpm
directly, the process owner is the executor.
MySQL container creates a anonymous volume(/var/lib/mysql
).
Though normally all of us do bind for persisting data, in case we didn't,
recreating mysql container leaves lots of unused volumes.
Use .dockerignore to prevent irrelevant files be copied to docker image while building.
To run command on container by user: docker exec -u root <container> <cmd>
Each command in Dockerfile can be cached sequentially. To benefit from the cache mechanism, put commands foremost that:
- May not be changed frequently
- Most time consuming
- [nginx] Don't know why append
$query_string
to index.php