Easily spin up a Magento 2 shop for Development purposes
- Clone this repository and go into the directory
git clone https://github.com/m-a-x-s-e-e-l-i-g/magento-2-docker-quickstart
- Go into the directory
cd magento-2-docker-quickstart
- Spin up:
docker-compose up -d
- Access the container's CLI as root:
docker exec -it magento2 bash
- Change directory to the Magento root:
cd /bitnami/magento
Name | URL | Username | Password |
---|---|---|---|
Magento Frontend | http://localhost | ||
Magento Admin Backend | http://localhost/admin | user | bitnami1 |
PHPMyAdmin | http://localhost:8080 | root |
Benefits:
- Enhanced reporting: system logging in var/report is verbose which means an easier time troubleshooting;
- Non-cached static files: static files are written to pub/static everytime they’re called, which means every change you make will immediately be visible on the frontend
- Exception errors: are shown in the browser instead of being logged
Costs:
- Performance
Enable by using the following command:
php bin/magento deploy:mode:set developer
To check the currently set mode
php bin/magento deploy:mode:show
-
Get your authentication keys:
If you haven't got them already you could use the following guide:
https://devdocs.magento.com/guides/v2.4/install-gde/prereq/connect-auth.html
But it's as simple as this when you have a Magento Marketplace account:
-
Deploy sample data:
php bin/magento sampledata:deploy
- Fill in your authentication keys
- Upgrade & Flush cache
php bin/magento setup:upgrade
php bin/magento cache:flush
Use the commands
composer require vendor/module
php bin/magento module:enable Vendor_Module
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f -s standard
chmod -R 777 ./pub/ ./var/cache ./generated
php bin/magento cache:flush
To check installed modules:
php bin/magento module:status