Docker configuration for Magento 2 Open Source with Sample Data running on PHP-FPM 7.3, MySQL 5.7, Elasticsearch 7, Nginx, Composer.
Install Docker CE and Docker Compose.
Steps to install Magento 2 with sample data:
- Copy .env.sample into .env:
cp .env.sample .env
. - (Optionally) In order to use Composer's cache (which will make the process dramatically faster for future
installation), uncomment
COMPOSER_CACHE_DIR
in .env and- ~/.cache/composer:/home/docker/.cache/composer
in docker-compose.yml. Adjust values if you have different path. - (Optionally) In order to use stored Composer's configuration, uncomment
COMPOSER_HOME=/var/www/html/var/composer_home
in .env. - Edit .env with setting of public and private keys from your account on Magento Marketplace.
- Run
./setup.sh
- Add a line to your hosts file
127.0.0.1 <your.host>
- Open
<your.host>
in browser and have fun ;)
- Stop FPM container
docker-compose stop fpm
. - Write your current IP address into
XDEBUG_REMOTE_HOST
variable indocker-compose.yml
. - Set
XDEBUG_ENABLE
to"true"
indocker-compose.yml
. - In PhpStorm go to File -> Settings... -> Languages & Frameworks -> PHP -> Servers.
- Set
Host
:<your.host>
and some uniqueTitle
. - Check
use path mappings
and add/var/www/html/m2
opposite towww
directory. - In
docker-compose.yml
setPHP_IDE_CONFIG: "serverName=<Title>"
(Title
from step 5). - Re-build FPM container
docker-compose build --build-arg UID=$(id -u) fpm
. - Run FPM container with new configuration
docker-compose up --force-recreate fpm
. - Enable
Start Listening for PHP Debug Connections
.
- Update README.md:
- on which platform tested
- Move integration test configuration to override.yml
- Build PHP image and push it to Docker hub
- Rework file permissions
We use SemVer for versioning. For the versions available, see the [tags on this repository] (https://github.com/vasylmalanka/m2-sample-docker/tags).
- Vasyl Malanka - https://github.com/vasylmalanka
This project is licensed under the MIT License - see the [LICENSE] (https://github.com/nishanths/license/blob/master/LICENSE) file for details.