This image is built from the official php
repository and contains PHP configurations for Magento 2.
This image installs the following base packages:
composer
php-fpm
This image also installs the following PHP extensions, which are the minimally required extensions to install and run Magento 2:
gd
intl
mbstring
mcrypt
pdo_mysql
xsl
zip
This image will work out-of-the-box with Linux-based systems.
To use this image on other systems for local development, create a Dockerfile with anything specific to your local development platform.
For example, if using Dinghy on OS X, use:
FROM mageinferno/magento2-php:[TAG]
RUN usermod -u 501 www-data
Then build your custom image:
docker build -t myname/php .
The following variables may be set to control the PHP environment:
PHP_MEMORY_LIMIT
: (default2048M
) Set the memory_limit of php.iniPHP_PORT
: (default:9000
) Set a custom PHP portPHP_PM
: (defaultdynamic
) Set the process managerPHP_PM_MAX_CHILDREN
: (default:10
) Set the max number of children processesPHP_PM_START_SERVERS
: (default:4
) Set the default number of servers to start at runtimePHP_PM_MIN_SPARE_SERVERS
: (default2
) Set the minumum number of spare serversPHP_PM_MAX_SPARE_SERVERS
: (default:6
) Set the maximum number of spare serversAPP_MAGE_MODE
: (default:default
) Set the MAGE_MODE
This image can run one-off PHP commands, such as:
docker run --rm --name php-test mageinferno/magento2-php echo "Hello world"
By default, you should place application code in /src
, or attach a volume at that location. When doing so, you can then run Magento-specific commands such as the Magento CLI tool:
docker run --rm --name mysite -v /Users/username/Sites/mysite/src:/src mageinferno/magento2-php ./bin/magento
Please see https://github.com/mageinferno/magento2-docker-compose for more detailed instructions and an example development environment using Docker Compose.