Composer package for dockerizing Magento 2

Overview

Dockerize Magento 2

A composer package for dockerizing Magento 2

The composer package arvatoscm/dockerize-magento2 deploys docker infrastructure defintion files such as docker-compose.yml to your Magento 2 root folder and enables you to host your Magento 2 shops without having to install Apache/Nginx, MySQL or PHP on your system.

Package Name

arvatoscm/dockerize-magento2

Software Requirements

For Linux users you must have a recent version of docker and docker-compose installed.

If you are a Mac or Windows user, use the Docker Toolbox.

Installation

Add arvatoscm/dockerize-magento2 to your existing Magento 2 shop:

composer require --ignore-platform-reqs arvatoscm/dockerize-magento2
chmod +x bin/console

This will place some files in your Magento root:

  • docker-compose.yml The docker infrastructure definition
  • bin/console A utility script for controlling dockerized Magento projects
  • config A folder which contains the configuration files for PHP, Nginx and phpMyAdmin

Usage

dockerize-magento2 comes with bin/console script that can be used to install Magento and to execute Magentos' bin/magento script inside the PHP docker container:

Trigger the Magento 2 installation process:

bin/console install <hostname>

Start the docker containers:

bin/console start

Stop the docker containers:

bin/console stop

Execute bin/magento inside the docker container:

bin/console exec [arguments]

For more information on how to use docker-compose visit: https://docs.docker.com/compose/

Configuration

The install action depends on some parameters such as usernames and passwords. We have put in some default values for you that will work for a quick test:

DATABASE_NAME="magento2dockerized"
DATABASE_USER="magento"
DATABASE_PASSWORD="enAVINa2"
DATABASE_ROOT_PASSWORD="enAVINa2"

ADMIN_USERNAME="admin"
ADMIN_FIRSTNAME="Admin"
ADMIN_LASTNAME="Inistrator"
ADMIN_EMAIL="[email protected]"
ADMIN_PASSWORD="enAVINa2"

DEFAULT_LANGUAGE="en_US"
DEFAULT_CURRENCY="EUR"
DEFAULT_TIMEZONE="Europe/Berlin"

BACKEND_FRONTNAME="management"

If you want to use different parameters change the values in the .env file to your needs. After customizing the parameters just run trigger the installation with bin/console install <hostname>.

Licensing

dockerize-magento2 is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Comments
  • Update Composer Dependencies?

    Update Composer Dependencies?

    I have been using your Magento 1.x workflow using "./magento composer update" - can you share the equivalent to that using the Magento 2.x project? Thank you!

    opened by brandontamm 4
  • Variables not set

    Variables not set

    I cloned the repo and ran the installer - no modifications. I am getting this: WARNING: The DATABASE_ROOT_PASSWORD variable is not set. Defaulting to a blank string. WARNING: The DATABASE_USER variable is not set. Defaulting to a blank string. WARNING: The DATABASE_NAME variable is not set. Defaulting to a blank string.

    The env variables are there - not sure why it isn't reading them?

    opened by brandontamm 3
  • SQL Error and Multiple Errors relating..

    SQL Error and Multiple Errors relating..

    I am using brand new magento composer-project and have tried both the 'develop' and 'master' branch of your project. I have the same issue on remote ubuntu and local 2016 OS X running native docker. After running bin/console install site.dev, I receive the following error multiple times:

    SQLSTATE[HY000] [1045] Access denied for user 'ceg'@'172.20.0.5' (using password: YES)

    [InvalidArgumentException]
    Parameter validation failed

    setup:install [--backend-frontname="..."] [--amqp-host="..."] [--amqp-port="..."] [--amqp-user="..."] [--amqp-password="..."] [--amqp-virtualhost="..."] [--amqp-ssl="..."] [--key="..."] [--session-save="..."] [--definition-format="..."] [--db-host="..."] [--db-name="..."] [--db-user="..."] [--db-engine="..."] [--db-password="..."] [--db-prefix="..."] [--db-model="..."] [--db-init-statements="..."] [-s|--skip-db-validation] [--http-cache-hosts="..."] [--base-url="..."] [--language="..."] [--timezone="..."] [--currency="..."] [--use-rewrites="..."] [--use-secure="..."] [--base-url-secure="..."] [--use-secure-admin="..."] [--admin-use-security-key="..."] [--admin-user="..."] [--admin-password="..."] [--admin-email="..."] [--admin-firstname="..."] [--admin-lastname="..."] [--cleanup-database] [--sales-order-increment-prefix="..."] [--use-sample-data] [--magento-init-params="..."]

    [Magento\Setup\Exception]
    Can't run this operation: deployment configuration is absent. Run 'magento setup:config:set --help' for options.

    setup:upgrade [--keep-generated] [--magento-init-params="..."]

    [InvalidArgumentException]
    There are no commands defined in the "cache" namespace.

    [InvalidArgumentException]
    There are no commands defined in the "indexer" namespace.

    opened by brandontamm 2
  • Installation Error (not accessible / not valid URL)

    Installation Error (not accessible / not valid URL)

    Hi,

    I want to report the following error when running bin/console install <host_name>:

    ERROR: build path <dev_path>/arvato/magento2-php:latest either does not exist, is not accessible, or is not a valid URL.
    

    Thank you!

    opened by sutris 2
  • SQL Import?

    SQL Import?

    I see that db:import is missing from Magento's CLI tool - just wondering if there is a db-deployment workaround since you included phpmyadmin? Can you share how to import? How are you accessing phpmyadmin - sequel pro with credentials?

    opened by brandontamm 2
  • Cant install Sample Data

    Cant install Sample Data

    Ive been trying to install sample data bin/console exec through sampledata:deploy and this is what i get:

    Installation failed, reverting ./composer.json to its original content.
    
      [RuntimeException]                                                                                
      /var/www/html/vendor/magento/module-catalog-sample-data does not exist and could not be created.  
    

    Is there any alternative way to install sample data? Thanks in advance.

    opened by elbrodelche 1
  • Can't create directory /var/www/html/generated/code/Magento/Framework/App/ResourceConnection/. in [Magento\Framework\App\ResourceConnection\Proxy]

    Can't create directory /var/www/html/generated/code/Magento/Framework/App/ResourceConnection/. in [Magento\Framework\App\ResourceConnection\Proxy]

    I am getting this error when running bin/console install

    what should the file permissions be in order to get them to write successfully?

    I am running this on ubuntu

    image

    opened by jking6884 0
  • Allow to alias IP

    Allow to alias IP

    Change docker-compose.yml

        ports:
          - "80:80"
          - "443:443"
    

    TO:

     ports:
          - "${PROJECT_IP}:80:80"
          - "${PROJECT_IP}:443:443"
    

    Add PROJECT_IP in .env

    IP can set by on MAC and Linux sudo ifconfig lo0 alias your_project_ip

    opened by larsroettig 0
  • Error when creating PHP Container..

    Error when creating PHP Container..

    Again, this is a vanilla git clone, but I am seeing this error:

    Creating magento2_php_1

    ERROR: for php Container command 'php-fpm' could not be invoked. Traceback (most recent call last): File "/usr/local/Cellar/docker-compose/1.7.1/libexec/bin/docker-compose", line 9, in load_entry_point('docker-compose==1.7.1', 'console_scripts', 'docker-compose')() File "/usr/local/Cellar/docker-compose/1.7.1/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 63, in main log.error(e.msg) AttributeError: 'ProjectError' object has no attribute 'msg' Error response from daemon: Container b88f9478ae2b9c279e5645d83947b603d2573b4328f55e5cc6ae6431cd9f5c0d is not running Error response from daemon: Container b88f9478ae2b9c279e5645d83947b603d2573b4328f55e5cc6ae6431cd9f5c0d is not running Error response from daemon: Container b88f9478ae2b9c279e5645d83947b603d2573b4328f55e5cc6ae6431cd9f5c0d is not running Error response from daemon: Container b88f9478ae2b9c279e5645d83947b603d2573b4328f55e5cc6ae6431cd9f5c0d is not running

    Installation complete.

    opened by brandontamm 0
  • Pipe Error: System Cannot Find File Specified

    Pipe Error: System Cannot Find File Specified

    Been working through the youtube video, so far so good. I have what you have in the etc/hosts file

    I go to bin/console install docker.local and i get Windows named pipe error: The system cannot find the file specified (Code 2) No idea what this means or what to do, any help would be greatly appreciated it

    opened by birdman002 0
  • SQL Errors on fresh install

    SQL Errors on fresh install

    Below is the error i receive when trying install a fresh version from scratch.

    SQLSTATE[HY000] [1045] Access denied for user 'magento'@'172.29.0.5' (using password: YES)

    [InvalidArgumentException] Parameter validation failed

    setup:install [--backend-frontname BACKEND-FRONTNAME] [--key KEY] [--db-host DB-HOST] [--db-name DB-NAME] [--db-user DB-USER] [--db-engine DB-ENGINE] [--db-password DB-PASSWORD] [--db-prefix DB-PREFIX] [--db-model DB-MODEL] [--db-init-statements DB-INIT-STATEMENTS] [-s|--skip-db-validation] [--http-cache-hosts HTTP-CACHE-HOSTS] [--session-save SESSION-SAVE] [--session-save-redis-host SESSION-SAVE-REDIS-HOST] [--session-save-redis-port SESSION-SAVE-REDIS-PORT] [--session-save-redis-password SESSION-SAVE-REDIS-PASSWORD] [--session-save-redis-timeout SESSION-SAVE-REDIS-TIMEOUT] [--session-save-redis-persistent-id SESSION-SAVE-REDIS-PERSISTENT-ID] [--session-save-redis-db SESSION-SAVE-REDIS-DB] [--session-save-redis-compression-threshold SESSION-SAVE-REDIS-COMPRESSION-THRESHOLD] [--session-save-redis-compression-lib SESSION-SAVE-REDIS-COMPRESSION-LIB] [--session-save-redis-log-level SESSION-SAVE-REDIS-LOG-LEVEL] [--session-save-redis-max-concurrency SESSION-SAVE-REDIS-MAX-CONCURRENCY] [--session-save-redis-break-after-frontend SESSION-SAVE-REDIS-BREAK-AFTER-FRONTEND] [--session-save-redis-break-after-adminhtml SESSION-SAVE-REDIS-BREAK-AFTER-ADMINHTML] [--session-save-redis-first-lifetime SESSION-SAVE-REDIS-FIRST-LIFETIME] [--session-save-redis-bot-first-lifetime SESSION-SAVE-REDIS-BOT-FIRST-LIFETIME] [--session-save-redis-bot-lifetime SESSION-SAVE-REDIS-BOT-LIFETIME] [--session-save-redis-disable-locking SESSION-SAVE-REDIS-DISABLE-LOCKING] [--session-save-redis-min-lifetime SESSION-SAVE-REDIS-MIN-LIFETIME] [--session-save-redis-max-lifetime SESSION-SAVE-REDIS-MAX-LIFETIME] [--cache-backend CACHE-BACKEND] [--cache-backend-redis-server CACHE-BACKEND-REDIS-SERVER] [--cache-backend-redis-db CACHE-BACKEND-REDIS-DB] [--cache-backend-redis-port CACHE-BACKEND-REDIS-PORT] [--page-cache PAGE-CACHE] [--page-cache-redis-server PAGE-CACHE-REDIS-SERVER] [--page-cache-redis-db PAGE-CACHE-REDIS-DB] [--page-cache-redis-port PAGE-CACHE-REDIS-PORT] [--page-cache-redis-compress-data PAGE-CACHE-REDIS-COMPRESS-DATA] [--base-url BASE-URL] [--language LANGUAGE] [--timezone TIMEZONE] [--currency CURRENCY] [--use-rewrites USE-REWRITES] [--use-secure USE-SECURE] [--base-url-secure BASE-URL-SECURE] [--use-secure-admin USE-SECURE-ADMIN] [--admin-use-security-key ADMIN-USE-SECURITY-KEY] [--admin-user ADMIN-USER] [--admin-password ADMIN-PASSWORD] [--admin-email ADMIN-EMAIL] [--admin-firstname ADMIN-FIRSTNAME] [--admin-lastname ADMIN-LASTNAME] [--cleanup-database] [--sales-order-increment-prefix SALES-ORDER-INCREMENT-PREFIX] [--use-sample-data] [-i|--interactive] [--magento-init-params MAGENTO-INIT-PARAMS]

    Can't run this operation: deployment configuration is absent. Run 'magento setup:config:set --help' for options.

    [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "cache" namespace.

    [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "indexer" namespace.

    I read a closed issue which stated this was due to running an older version but this is a fresh install of the latest version.

    opened by RichDKick 0
  • Import action included to import existing Magento projects

    Import action included to import existing Magento projects

    The import action gives you the ability to set up your existing project. You only need to place you database sql file(s) into config/mysql/ and provide the following parameters.

    bin/console import <hostname> [crypt]
    

    This will detect if your Magento project is an Enterprise or Community version and download an env.php template and fill it up automatically.

    The crypt parameter is optional but we recommend to provide it based on the original env.php file.

    opened by fsspencer 0
  • Multisite Configuration

    Multisite Configuration

    Since a giant benefit to Magento is multisite configuration, would anyone be willing to add additional configuration options ... like 'bin/console add www.example.com' which would create additional nginx configuration?

    This would be AWESOME functionality - especially when it comes to blue/green style deployments with multiple sites and continuous integration :)

    opened by brandontamm 3
  • Generating SSL certificates failed

    Generating SSL certificates failed

    Hi there,

    I got an error, would you please help me a little bit?

    bin/console install docker.local Generating SSL certificates failed. Please place the key and certificate into the certificate-folder "/c/Users/PC000056/magento2/config/nginx/ssl": Key: /c/Users/PC000056/magento2/config/nginx/ssl/key.pem Cert: /c/Users/PC000056/magento2/config/nginx/ssl/cert.pem

    How can i sovle this?

    Thank you

    opened by harrywutech 3
Owner
arvato SCM Solutions
arvato SCM Solutions
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

composer-custom-directory-installer A composer plugin, to install differenty types of composer packages in custom directories outside the default comp

Mina Nabil Sami 136 Dec 30, 2022
Composer Repository Manager for selling Magento 2 extension and offering composer installation for ordered packages.

Magento 2 Composer Repository Credits We got inspired by https://github.com/Genmato. Composer Repository for Magento 2 This extension works as a Magen

EAdesign 18 Dec 16, 2021
Composer Registrar Composer Plugin for Magento 2

This module add a global registration.php that replace the default glob search performed for each request to discover the components not installed from composer.

OpenGento 3 Mar 22, 2022
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

Tao 500 Dec 29, 2022
Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

Imposter Plugin Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins. Built with ♥ by Typ

Typist Tech 127 Dec 17, 2022
Dependency graph visualization for composer.json (PHP + Composer)

clue/graph-composer Graph visualization for your project's composer.json and its dependencies: Table of contents Usage graph-composer show graph-compo

Christian Lück 797 Jan 5, 2023
Drupal Composer Scaffold - A flexible Composer project scaffold builder

This project provides a composer plugin for placing scaffold files (like index.php, update.php, …) from the drupal/core project into their desired location inside the web root. Only individual files may be scaffolded with this plugin.

Drupal 44 Sep 22, 2022
Victor The Cleaner for Composer - This tool removes unnecessary files and directories from Composer vendor directory.

Victor The Cleaner for Composer This tool removes unnecessary files and directories from Composer vendor directory. The Cleaner leaves only directorie

David Grudl 133 Oct 26, 2022
Opinionated version of Wikimedia composer-merge-plugin to work in pair with Bamarni composer-bin-plugin.

Composer Inheritance Plugin Opinionated version of Wikimedia composer-merge-plugin to work in pair with bamarni/composer-bin-plugin. Usage If you are

Théo FIDRY 25 Dec 2, 2022
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022
Magento 2 Spanish (Spain) language package - Paquete de idioma Español (España) para Magento 2

Magento 2 Spanish (Spain) language package - Paquete de idioma Español (España) para Magento 2 Traducciones Se han recopilado las traducciones existen

Lito 13 Aug 5, 2022
Quickly execute Composer package binaries from anywhere. ⚡️

✨ Help support the maintenance of this package by sponsoring me. cpx Quickly execute Composer package binaries from anywhere. ⚡️ Installation Run the

Ryan Chandler 57 Dec 25, 2022
A Composer Package which installs the PhantomJS binary (Linux, Windows, Mac) into /bin of your project.

phantomjs-installer A Composer package which installs the PhantomJS binary (Linux, Windows, Mac) into /bin of your project. Table of Contents Installa

Jens A. Koch 149 Nov 8, 2022
A composer package designed to help you create a JSON:API in Phalcon

phalcon-json-api-package A composer package designed to help you create a JSON:API in Phalcon What happens when a PHP developer wants to create an API

Jim 36 Oct 7, 2022