Skip to content

EmakinaFR/docker-magento

Repository files navigation

Docker for Magento

License: MIT

This repository allows the creation of a Docker environment that meets Magento 1 requirements.

⚠️ The master branch uses PHP 7.2 which is not compatible with Magento by default. The latest version with PHP 5.6 is available under the tag v2.3 if you do not plan to upgrade your PHP version. ⚠️

Images

  • httpd:2.4-alpine: custom image with apache 2.4 (web server).
  • blackfire/blackfire:latest: application profiling.
  • djfarrelly/maildev:latest: emails web Interface for viewing and testing emails during development.
  • mongo:3.6: additional database.
  • mysql:8: magento database.
  • php:7.2-fpm-alpine: custom image with php-fpm 7.2.
  • redis:6-alpine: magento sessions and caches.

Additional Features

Since this environment is designed for a local usage, it comes with features helping the development workflow.

The apache and php containers have a mount point used to share source files. By default, the ~/www/ directory is mounted from the host. It's possible to change this path by editing the docker-compose.yml file.

It's also possible to add custom virtual hosts: all ./apache/vhosts/*.conf files are copied in the Apache directory during the image build process.

And the ./php/custom.ini file is used to customize the PHP configuration during the image build process.

Installation

This process assumes that Docker Engine and Docker Compose are installed. Otherwise, you should have a look to Install Docker Engine before proceeding further.

Clone the repository

$ git clone git@github.com:EmakinaFR/docker-magento.git magento1

It's also possible to download it as a ZIP archive.

Configure the environment variables (optional)

$ make env

Build the environment

$ make install

Check the containers

$ make ps
        Name                      Command               State              Ports
--------------------------------------------------------------------------------------------
magento1_apache_1      httpd-foreground                 Up      0.0.0.0:443->443/tcp, 80/tcp
magento1_blackfire_1   blackfire-agent                  Up      8707/tcp
magento1_maildev_1     bin/maildev --web 80 --smtp 25   Up      25/tcp, 0.0.0.0:1080->80/tcp
magento1_mongo_1       docker-entrypoint.sh mongod      Up      0.0.0.0:27017->27017/tcp
magento1_mysql_1       docker-entrypoint.sh mysqld      Up      0.0.0.0:3306->3306/tcp
magento1_php_1         docker-custom-entrypoint p ...   Up      9000/tcp
magento1_redis_1       docker-entrypoint.sh redis ...   Up      6379/tcp

Note: You will see something slightly different if you do not clone the repository in a magento1 directory. The container prefix depends on your directory name.