Simple compose for Magento 2 that contains:
- PHP 7.0 (PHP-FPM with xDebug:9000)
- Nginx (latest)
- Redis (latest)
- MySQL (latest)
All required libraries are in-box.
Configuration file is located in config/env.sh (change it before installation if needed)
git submodule add -f path_to_your_project_git_repo web
. Put your Magento 2 project files into ./web folder.- $
docker-machine create customvmname --driver virtualbox
WARNING: Regular expression for customvmname/^[a-zA-Z0-9]+[a-zA-Z]$/
. If you use MacOS, then you should use "vmwarefusion" driver, because of VB file permission problems with MacOS volumes. - $
eval $(docker-machine env customvmname)
- $
chmod u+x bin/console
- $
bin/console install yourdomain.local
. If error occures try to run withsudo
- Process can take up to 30 min
- $
docker-machine ip customvmname
(get machine IP) - Copy output of step #7 to /etc/hosts as domain you set in step #5
- Check in browser. Done ;)
- To start docker-machine use
docker-machine start yourmvmname
- To stop docker-machine use
docker-machine stop yourmvmname
- To start compose inside docker-machine use
bin/console start
- To stop compose inside docker-machine use
bin/console stop
- To restart compose inside docker-machine use
bin/console restart
- To run bin/magento command use
bin/console magento [arguments]
eg.bin/console magento cache:clean
- To open redis-cli just use
bin/console redis-cli [arguments]
eg.bin/console redis-cli flushall
- To see (in real time) nginx errors
bin/console nginx-error-logs|nginx-access-logs
. Usenginx-error-logs
for tailing /var/log/nginx/error.log andnginx-access-logs
for tailing /var/log/nginx/access.log
While you run bin/console install yourdomain.local
, following actions are doing automatically:
- Install vendor magento using composer
- Install magento DB data (magento setup:install)
- Upgrade migration scripts (magento setup:upgrade)
- Reindexation (magento indexer:reindex)
- Set developer mode (deploy:mode:set developer)
- Backup od databese (setup:backup --db)
This solution is only improvement of @arvatoSCM project.