All Projects → meanbee → Docker Magento2

meanbee / Docker Magento2

Licence: mit
🐳 Docker containers with all required Magento 2 dependencies installed available as FPM through Nginx and CLI

Projects that are alternatives of or similar to Docker Magento2

Ddev
DDEV-Local: a local PHP development environment system
Stars: ✭ 915 (+116.31%)
Mutual labels:  magento2, docker-compose
Docker Magento Mutagen
Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
Stars: ✭ 64 (-84.87%)
Mutual labels:  magento2, docker-compose
Magento2 Varnish Redis Ssl Docker Compose
Deploy Magento2 with Varnish Cache and Redis with SSL termination using Docker-compose tool
Stars: ✭ 37 (-91.25%)
Mutual labels:  magento2, docker-compose
Magento Docker
Docker environment dedicated for ScandiPWA theme development
Stars: ✭ 98 (-76.83%)
Mutual labels:  magento2, docker-compose
Docker Magento
Mark Shust's Docker Configuration for Magento
Stars: ✭ 1,123 (+165.48%)
Mutual labels:  magento2, docker-compose
Docker Compose Development
Clone and `bin/dev up`. Quickly start of developing locally with Nginx, PHP, Blackfire, Percona, Mailhog and Redis. Out of the box support for Magento2 Developer Box
Stars: ✭ 171 (-59.57%)
Mutual labels:  magento2, docker-compose
Strimpack
A platform for livestreamers to make a home for their audience.
Stars: ✭ 378 (-10.64%)
Mutual labels:  docker-compose
Docker Compose Rule
A JUnit rule to manage docker containers using docker-compose
Stars: ✭ 393 (-7.09%)
Mutual labels:  docker-compose
Swarmlet
A self-hosted, open-source Platform as a Service that enables easy swarm deployments, load balancing, automatic SSL, metrics, analytics and more.
Stars: ✭ 373 (-11.82%)
Mutual labels:  docker-compose
Xxproject
SpringCloud 微服务综合实例。分布式配置中心,服务发现&负载均衡,链路断路器,API网关,OAuth2认证授权,分布式追踪,ELK日志中心,Ansible/Docker持续交付等最佳实践。
Stars: ✭ 371 (-12.29%)
Mutual labels:  docker-compose
Pfelk
pfSense/OPNsense + ELK
Stars: ✭ 417 (-1.42%)
Mutual labels:  docker-compose
Magento2
Docker Image to Magento 2 local development in Mac, Linux and Windows
Stars: ✭ 412 (-2.6%)
Mutual labels:  magento2
Enferno
A Python framework based on Flask microframework, with batteries included, and best practices in mind.
Stars: ✭ 385 (-8.98%)
Mutual labels:  docker-compose
Onpremise
Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
Stars: ✭ 4,558 (+977.54%)
Mutual labels:  docker-compose
Mailcow Dockerized
mailcow: dockerized - 🐮 + 🐋 = 💕
Stars: ✭ 4,573 (+981.09%)
Mutual labels:  docker-compose
Docker Stacks
DECK is a powerful and high performant local web development studio unlike any other.
Stars: ✭ 376 (-11.11%)
Mutual labels:  docker-compose
Magento2 Frontools
Set of front-end tools for Magento 2 based on Gulp.js
Stars: ✭ 416 (-1.65%)
Mutual labels:  magento2
Magento2 Theme Blank Sass
SASS based version of Magento 2 Blank theme
Stars: ✭ 373 (-11.82%)
Mutual labels:  magento2
Nginx Ui
Nginx UI allows you to access and modify the nginx configurations files without cli.
Stars: ✭ 4,067 (+861.47%)
Mutual labels:  docker-compose
Portainer Compose
Compose setup for Portainer
Stars: ✭ 408 (-3.55%)
Mutual labels:  docker-compose

Magento 2 Docker

Build Status Docker Build Status Docker Pulls Docker Stars

A collection of Docker images for running Magento 2 through nginx and on the command line.

Quick Start

cp composer.env.sample composer.env
# ..put the correct tokens into composer.env

mkdir magento

docker-compose run cli magento-installer
docker-compose up -d
docker-compose restart

Configuration

Configuration is driven through environment variables. A comprehensive list of the environment variables used can be found in each Dockerfile and the commands in each bin/ directory.

  • PHP_MEMORY_LIMIT - The memory limit to be set in the php.ini
  • UPLOAD_MAX_FILESIZE - Upload filesize limit for PHP and Nginx
  • MAGENTO_RUN_MODE - Valid values, as defined in Magento\Framework\App\State: developer, production, default.
  • MAGENTO_ROOT - The directory to which Magento should be installed (defaults to /var/www/magento)
  • COMPOSER_GITHUB_TOKEN - Your GitHub OAuth token, should it be needed
  • COMPOSER_MAGENTO_USERNAME - Your Magento Connect public authentication key (how to get)
  • COMPOSER_MAGENTO_PASSWORD - Your Magento Connect private authentication key
  • COMPOSER_BITBUCKET_KEY - Optional - Your Bitbucket OAuth key (how to get)
  • COMPOSER_BITBUCKET_SECRET - Optional - Your Bitbucket OAuth secret
  • DEBUG - Toggles tracing in the bash commands when exectued; nothing to do with Magento`
  • PHP_ENABLE_XDEBUG - When set to true it will include the Xdebug ini file as part of the PHP configuration, turning it on. It's recommended to only switch this on when you need it as it will slow down the application.
  • UPDATE_UID_GID - If this is set to "true" then the uid and gid of www-data will be modified in the container to match the values on the mounted folders. This seems to be necessary to work around virtualbox issues on OSX.

A sample docker-compose.yml is provided in this repository.

CLI Usage

A number of commands are baked into the image and are available on the $PATH. These are:

  • magento-command - Provides a user-safe wrapper around the bin/magento command.
  • magento-installer - Installs and configures Magento into the directory defined in the $MAGENTO_ROOT environment variable.
  • magento-extension-installer - Installs a Magento 2 extension from the /extensions/<name> directory, using symlinks.
  • magerun2 - A user-safe wrapper for n98-magerun2.phar, which provides a wider range of useful commands. Learn more here

It's recommended that you mount an external folder to /root/.composer/cache, otherwise you'll be waiting all day for Magento to download every time the container is booted.

CLI commands can be triggered by running:

docker-compose run cli magento-installer

Shell access to a CLI container can be triggered by running:

docker-compose run cli bash

Sendmail

All images have sendmail installed for emails, however it is not enabled by default. To enable sendmail, use the following environment variable:

ENABLE_SENDMAIL=true

Note: If sendmail has been enabled, make sure the container has a hostname assigned using the hostname field in docker-compose.yml or --hostname parameter for docker run. If the container does not have a hostname set, sendmail will attempt to discover the hostname on startup, blocking for a prolonged period of time.

Implementation Notes

  • In order to achieve a sane environment for executing commands in, a docker-environment script is included as the ENTRYPOINT in the container.

xdebug Usage

To enable xdebug, you will need to toggle the PHP_ENABLE_XDEBUG environment variable to true in global.env. Then when using docker-compose you will need to restart the fpm container using docker-compose up -d, or stopping and starting the container.

Varnish

Varnish is running out of the container by default. If you do not require varnish, then you will need to remove the varnish block from your docker-compose.yml and uncomment the environment section under the web container definition.

To clear varnish, you can use the cli containers magento-command to clear the cache, which will include varnish. Alternatively, you could restart the varnish container.

docker-compose run --rm cli magento-command cache:flush
# OR
docker-compose restart varnish

If you need to add your own VCL, then it needs to be mounted to: /data/varnish.vcl.

Building

A lot of the configuration for each image is the same, with the difference being the base image that they're extending from. For this reason we use php to build the Dockerfile from a set of templates in src/. The Dockerfile should still be published to the repository due to Docker Hub needing a Dockerfile to build from.

To build all Dockerfiles, run the builder.php script in the php:7 Docker image:

docker run --rm -it -v $(pwd):/src php:7 php /src/builder.php

Adding new images to the build config

The build configuration is controlled by the config.json file. Yeah element in the top level hash is a new build target, using the following syntax:

"<target-name>": {
    "version": "<php-version>",
    "flavour": "<image-flavour>",
    "files": {
        "<target-file-name>": {
            "<template-variable-name>": "<template-variable-value>",
            ...
        },
}

The target files will be rendered in the <php-version>-<image-flavour>/ directory.

The source template for each target file is selected from the src/ directory using the following fallback order:

  1. <target-file-name>-<php-version>-<image-flavour>
  2. <target-file-name>-<php-version>
  3. <target-file-name>-<image-flavour>
  4. <target-file-name>

Individual templates may include other templates as partials.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].