Mark Shust's Docker Configuration for Magento

Overview

markshust/docker-magento

Mark Shust's Docker Configuration for Magento

Supported Magento Versions Docker Hub Pulls - PHP Docker Hub Pulls - Nginx Maintained - Yes Apple Silicon Support

Table of contents

Docker Hub

View Dockerfiles:

Free Course

This course is sponsored by M.academy, the simplest way to learn Magento.

M.academy

A free screencast course is available (which was fully refreshed in December 2021), which details the basic usage of this project:

Set Up a Magento 2 Development Environment with Docker
Set Up a Magento 2 Development Environment with Docker

Course Curriculm

Intro

Initial Project Setup

The Basics of docker-magento

Docker Filesystem & Data Volumes

PhpStorm

Xdebug

Customize Server Configurations

Usage

This configuration is intended to be used as a Docker-based development environment for Magento 2.

Folders:

  • images: Docker images for nginx and php
  • compose: sample setups with Docker Compose

The Magento 1 version of this development environment has been deprecated and is no longer supported. PHP 5 was used as it's base, and that version has reached end-of-life. If you still wish to use this setup, please reference compose/magento-1 on tag 20.1.1, but please be aware these images are no longer maintained.

Prerequisites

This setup assumes you are running Docker on a computer with at least 6GB of RAM allocated to Docker, a dual-core, and an SSD hard drive. Download & Install Docker Desktop.

This configuration has been tested on Mac & Linux. Windows is supported through the use of Docker on WSL.

Setup

Automated Setup (New Project)

# Create your project directory then go into it:
mkdir ~/Sites/magento
cd $_

# Run this automated one-liner from the directory you want to install your project.
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.3-p1

The magento.test above defines the hostname to use, and the 2.4.3-p1 defines the Magento version to install. Note that since we need a write to /etc/hosts for DNS resolution, you will be prompted for your system password during setup.

After the one-liner above completes running, you should be able to access your site at https://magento.test.

Install sample data

After the above installation is complete, run the following lines to install sample data:

bin/magento sampledata:deploy
bin/magento setup:upgrade

Manual Setup

Same result as the one-liner above. Just replace magento.test references with the hostname that you wish to use.

New Projects

# Create your project directory then go into it:
mkdir ~/Sites/magento
cd $_

# Download the Docker Compose template:
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash

# Download the version of Magento you want to use with:
bin/download 2.4.3-p1

# or for Magento core development:
# docker-compose -f docker-compose.yml up -d
# bin/setup-composer-auth
# bin/cli git clone [email protected]:magento/magento2.git .
# bin/cli git checkout 2.4-develop
# bin/composer install

# Run the setup installer for Magento:
bin/setup magento.test

open https://magento.test

Existing Projects

# Take a backup of your existing database:
bin/mysqldump > ~/Sites/existing/magento.sql

# Create your project directory then go into it:
mkdir ~/Sites/magento
cd $_

# Download the Docker Compose template:
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash

# Replace with existing source code of your existing Magento instance:
cp -R ~/Sites/existing src
# or: git clone [email protected]:myrepo.git src

# Start some containers, copy files to them and then restart the containers:
docker-compose -f docker-compose.yml up -d
bin/copytocontainer --all ## Initial copy will take a few minutes...

# Import existing database:
bin/mysql < ../existing/magento.sql

# Update database connection details to use the above Docker MySQL credentials:
# Also note: creds for the MySQL server are defined at startup from env/db.env
# vi src/app/etc/env.php

# Import app-specific environment settings:
bin/magento app:config:import

# Create a DNS host entry and setup Magento base url
bin/setup-domain yoursite.test

bin/restart

open https://magento.test

Updates

To update your project to the latest version of docker-magento, run:

bin/update

We recommend keeping your docker config files in version control, so you can monitor the changes to files after updates. After reviewing the code updates and ensuring they updated as intended, run bin/restart to restart your containers to have the new configuration take effect.

It is recommended to keep your root docker config files in one repository, and your Magento code setup in another. This ensures the Magento base path lives at the top of one specific repository, which makes automated build pipelines and deployments easy to manage, and maintains compatibility with projects such as Magento Cloud.

Custom CLI Commands

  • bin/bash: Drop into the bash prompt of your Docker container. The phpfpm container should be mainly used to access the filesystem within Docker.
  • bin/cache-clean: Access the cache-clean CLI. Note the watcher is automatically started at startup in bin/start. Ex. bin/cache-clean config full_page
  • bin/cli: Run any CLI command without going into the bash prompt. Ex. bin/cli ls
  • bin/clinotty: Run any CLI command with no TTY. Ex. bin/clinotty chmod u+x bin/magento
  • bin/cliq: The same as bin/cli, but pipes all output to /dev/null. Useful for a quiet CLI, or implementing long-running processes.
  • bin/composer: Run the composer binary. Ex. bin/composer install
  • bin/copyfromcontainer: Copy folders or files from container to host. Ex. bin/copyfromcontainer vendor
  • bin/copytocontainer: Copy folders or files from host to container. Ex. bin/copytocontainer --all
  • bin/cron: Start or stop the cron service. Ex. bin/cron start
  • bin/dev-urn-catalog-generate: Generate URN's for PhpStorm and remap paths to local host. Restart PhpStorm after running this command.
  • bin/devconsole: Alias for bin/n98-magerun2 dev:console
  • bin/download: Download specific Magento version from Composer to /var/www/html directory within the container. Ex. bin/download 2.4.3-p1 community
  • bin/fixowns: This will fix filesystem ownerships within the container.
  • bin/fixperms: This will fix filesystem permissions within the container.
  • bin/grunt: Run the grunt binary. Ex. bin/grunt exec
  • bin/magento: Run the Magento CLI. Ex: bin/magento cache:flush
  • bin/mftf: Run the Magento MFTF. Ex: bin/mftf build:project
  • bin/mysql: Run the MySQL CLI with database config from env/db.env. Ex. bin/mysql -e "EXPLAIN core_config_data" orbin/mysql < magento.sql
  • bin/mysqldump: Backup the Magento database. Ex. bin/mysqldump > magento.sql
  • bin/n98-magerun2: Access the n98-magerun2 CLI. Ex: bin/n98-magerun2 dev:console
  • bin/node: Run the node binary. Ex. bin/node --version
  • bin/npm: Run the npm binary. Ex. bin/npm install
  • bin/pwa-studio: (BETA) Start the PWA Studio server. Note that Chrome will throw SSL cert errors and not allow you to view the site, but Firefox will.
  • bin/redis: Run a command from the redis container. Ex. bin/redis redis-cli monitor
  • bin/remove: Remove all containers.
  • bin/removeall: Remove all containers, networks, volumes, and images.
  • bin/removevolumes: Remove all volumes.
  • bin/restart: Stop and then start all containers.
  • bin/root: Run any CLI command as root without going into the bash prompt. Ex bin/root apt-get install nano
  • bin/rootnotty: Run any CLI command as root with no TTY. Ex bin/rootnotty chown -R app:app /var/www/html
  • bin/setup: Run the Magento setup process to install Magento from the source code, with optional domain name. Defaults to magento.test. Ex. bin/setup magento.test
  • bin/setup-composer-auth: Setup authentication credentials for Composer.
  • bin/setup-domain: Setup Magento domain name. Ex: bin/setup-domain magento.test
  • bin/setup-grunt: Install and configure Grunt JavaScript task runner to compile .less files
  • bin/setup-pwa-studio: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud will be used. Ex: bin/setup-pwa-studio magento.test
  • bin/setup-ssl: Generate an SSL certificate for one or more domains. Ex. bin/setup-ssl magento.test foo.test
  • bin/setup-ssl-ca: Generate a certificate authority and copy it to the host.
  • bin/start: Start all containers, good practice to use this instead of docker-compose up -d, as it may contain additional helpers.
  • bin/status: Check the container status.
  • bin/stop: Stop all project containers.
  • bin/stopall: Stop all docker running containers
  • bin/update: Update your project to the most recent version of docker-magento.
  • bin/xdebug: Disable or enable Xdebug. Accepts params disable (default) or enable. Ex. bin/xdebug enable

Misc Info

Caching

For an improved developer experience, caches are automatically refreshed when related files are updated, courtesy of cache-clean. This means you can keep all of the standard Magento caches enabled, and this script will only clear the specific caches needed, and only when necessary.

To disable this functionality, uncomment the last line in the bin/start file to disable the watcher.

Database

The hostname of each service is the name of the service within the docker-compose.yml file. So for example, MySQL's hostname is db (not localhost) when accessing it from within a Docker container. Elasticsearch's hostname is elasticsearch.

To connect to the MySQL CLI tool of the Docker instance, run:

bin/mysql

You can use the bin/mysql script to import a database, for example a file stored in your local host directory at magento.sql:

bin/mysql < magento.sql

You also can use bin/mysqldump to export the database. The file will appear in your local host directory at magento.sql:

bin/mysqldump > magento.sql

Getting an "Access denied, you need (at least one of) the SUPER privilege(s) for this operation." message when running one of the above lines? Try running it as root with:

bin/clinotty mysql -hdb -uroot -pmagento magento < src/backup.sql

You can also remove the DEFINER lines from the MySQL backup file with:

sed 's/\sDEFINER=`[^`]*`@`[^`]*`//g' -i src/backup.sql

Composer Authentication

First setup Magento Marketplace authentication (details in the DevDocs).

Copy src/auth.json.sample to src/auth.json. Then, update the username and password values with your Magento public and private keys, respectively. Finally, copy the file to the container by running bin/copytocontainer auth.json.

Email / Mailcatcher

View emails sent locally through Mailcatcher by visiting http://{yourdomain}:1080. During development, it's easiest to test emails using a third-party module such as [https://github.com/mageplaza/magento-2-smtp](Mageplaza's SMTP module). Set the mailserver host to mailcatcher and port to 1080.

Redis

Redis is now the default cache and session storage engine, and is automatically configured & enabled when running bin/setup on new installs.

Use the following lines to enable Redis on existing installs:

Enable for Cache:

bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0

Enable for Full Page Cache:

bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=1

Enable for Session:

bin/magento setup:config:set --session-save=redis --session-save-redis-host=redis --session-save-redis-log-level=4 --session-save-redis-db=2

You may also monitor Redis by running: bin/redis redis-cli monitor

For more information about Redis usage with Magento, see the DevDocs.

Xdebug & VS Code

Install and enable the PHP Debug extension from the Visual Studio Marketplace.

Otherwise, this project now automatically sets up Xdebug support with VS Code. If you wish to set this up manually, please see the .vscode/launch.json file.

Xdebug & PhpStorm

  1. First, install the Chrome Xdebug helper. After installed, right click on the Chrome icon for it and go to Options. Under IDE Key, select PhpStorm from the list to set the IDE Key to "PHPSTORM", then click Save.

  2. Next, enable Xdebug debugging in the PHP container by running: bin/xdebug enable.

  3. Then, open PhpStorm > Preferences > PHP and configure:

    • CLI Interpreter

      • Create a new interpreter from the From Docker, Vagrant, VM... list.
      • Select the Docker Compose option.
      • For Server, select Docker. If you don't have Docker set up as a server, create one and name it Docker.
      • For Configuration files, add both the docker-compose.yml and docker-compose.dev.yml files from your project directory.
      • For Service, select phpfpm, then click OK.
      • Name this CLI Interpreter phpfpm, then click OK again.
    • Path mappings

      • There is no need to define a path mapping in this area.
  4. Open PhpStorm > Preferences > PHP > Debug and ensure Debug Port is set to 9000,9003.

  5. Open PhpStorm > Preferences > PHP > Servers and create a new server:

    • For the Name, set this to the value of your domain name (ex. magento.test).
    • For the Host, set this to the value of your domain name (ex. magento.test).
    • Keep port set to 80.
    • Check the "Use path mappings" box and map src to the absolute path of /var/www/html.
  6. Go to Run > Edit Configurations and create a new PHP Remote Debug configuration.

    • Set the Name to the name of your domain (ex. magento.test).
    • Check the Filter debug connection by IDE key checkbox, select the Server you just setup.
    • For IDE key, enter PHPSTORM. This value should match the IDE Key value set by the Chrome Xdebug Helper.
    • Click OK to finish setting up the remote debugger in PHPStorm.
  7. Open up pub/index.php and set a breakpoint near the end of the file.

    • Start the debugger with Run > Debug 'magento.test', then open up a web browser.
    • Ensure the Chrome Xdebug helper is enabled by clicking on it and selecting Debug. The icon should turn bright green.
    • Navigate to your Magento store URL, and Xdebug should now trigger the debugger within PhpStorm at the toggled breakpoint.

SSH

Since version 40.0.0, this project supports connecting to Docker with SSH/SFTP. This means that if you solely use either PhpStorm or VSCode, you no longer need to selectively mount host volumes in order to gain bi-directional sync capabilities from host to container. This will enable full speed in the native filesystem, as all files will be stored directly in the appdata container volume, rather than being synced from the host. This is especially useful if you'd like to sync larger directories such as generated, pub & vendor.

Copy docker-compose.dev-ssh.yml to docker-compose.dev.yml before installing Magento to take advantage of this setup. Then, create an SFTP connection at Preferences -> Build, Execution, Deployment -> Deployment. Connect to localhost and use app for the username & password. You can set additional options for working with Magento in PhpStorm at Preferences -> Build, Execution, Deployment -> Deployment -> Options.

Note that you must use your IDE's SSH/SFTP functionality, otherwise changes will not be synced. To re-sync your host environment at any time, run:

bin/copyfromcontainer --all

Linux

Running Docker on Linux should be pretty straight-forward. Note that you need to run some post install commands as well as installing Docker Compose before continuing. These steps are taken care of automatically with Docker Desktop, but not on Linux.

Copy docker-compose.dev-linux.yml to docker-compose.dev.yml before installing Magento to take advantage of this setup.

The host.docker.internal hostname

The host.docker.internal hostname is used on Docker for Mac/Windows to reference the Docker daemon. On Linux, this hostname does not exist.

This hostname is hard-coded in the php.ini file. To make this hostname resolve, add "host.docker.internal:172.17.0.1" to the app.extra_hosts parameter of docker-compose.yml, replacing 172.17.0.1 with the result of:

docker run --rm alpine ip route | awk 'NR==1 {print $3}'

You must also create a new entry in your /etc/hosts file using the same IP:

172.17.0.1 host.docker.internal

Extra settings

To enable Xdebug on Linux, you may also need to open port 9003 on the firewall by running:

sudo iptables -A INPUT -p tcp --dport 9003 -j ACCEPT

You may also have to increase a virtual memory map count on the host system which is required by Elasticsearch.

Add the following line to the /etc/sysctl.conf file on your host:

vm.max_map_count=262144

Blackfire.io

These docker images have built-in support for Blackfire.io. To use it, first register your server ID and token with the Blackfire agent:

bin/root blackfire-agent --register --server-id={YOUR_SERVER_ID} --server-token={YOUR_SERVER_TOKEN}

Next, open up the bin/start helper script and uncomment the line:

#bin/root /etc/init.d/blackfire-agent start

Finally, restart the containers with bin/restart. After doing so, everything is now configured and you can use a browser extension to profile your Magento store with Blackfire.

MFTF

To work with MFTF you will need to first enable the selenium image in the docker-compose.dev.yml file. Then, you will need to run the following.

  1. Run mftf build process bin/mftf build:project. This should build the basic setup for mftf in your project.
  2. Update the extra_host values to match your Magento URL and IP in docker-compose.dev.yml.
  3. Update the values in src/dev/tests/acceptance/.env, including adding the new line SELENIUM_HOST=selenium to define the host Codeception should connect to.
  4. Run a sample test bin/mftf run:test AdminLoginSuccessfulTest.
  5. Update your nginx.conf file to allow access to the dev section with the following, before the final deny all section:
location ~* ^/dev/tests/acceptance/utils($|/) {
    root $MAGE_ROOT;
    location ~ ^/dev/tests/acceptance/utils/command.php {
        fastcgi_pass   fastcgi_backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

For debugging, you can connect to the selenium image using a VCN client.

  • Connect with the VCN option and 127.0.0.1:5900, (default password: secret)
  • Run bin/mftf doctor to validate all sections are setup correctly.

Find more info here about mftf configuration.

Credits

M.academy

This course is sponsored by M.academy, the simplest way to learn Magento.

M.academy

Mark Shust

My name is Mark Shust and I'm the creator of this repo. I'm a Zend Certified Engineer and Adobe Certified Magento Developer, and have been involved since the early days of Magento (0.8!). I'm no longer available for consulting, but am creating course content full-time at M.academy.

You can follow me on Twitter @MarkShust, connect with me on LinkedIn @MarkShust, read my blog at markshust.com, or contact me directly at [email protected].

License

MIT

Comments
  • Fatal error: Uncaught Zend_Cache_Exception

    Fatal error: Uncaught Zend_Cache_Exception

    After running docker-compose up, all of the containers load, but I get a fatal PHP error:

    Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/src/var/page_cache" is not writable in /src/vendor/magento/zendframework1/library/Zend/Cache.php:209 
    Stack trace: 
    #0 /src/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/src...')
    #1 /src/lib/internal/Cm/Cache/Backend/File.php(82): Zend_Cache_Backend_File->setCacheDir('/src/var/page_c...')
    #2 /src/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)
    #3 /src/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)
    #4 /src/vendor/magento/framework/App/Cache/Frontend/Factory.php(154): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)
    #5 /src/vendor/magento/framework/App/Cache/Frontend/Pool.php(67): Magento\Framework\App\Cache\Frontend\Factory->create(Array)
    #6 /src/vendor/magento/framework/App/Cache/Frontend/Pool.php(146): Magento\Framework\App\Cach in /src/vendor/magento/zendframework1/library/Zend/Cache.php on line 209
    

    Please help!

    opened by jagwire16 55
  • onelinesetup - Could not connect to Amqp Server on WSL2

    onelinesetup - Could not connect to Amqp Server on WSL2

    I'm trying to run onelinesetup on a Windows 10 machine with WSL2 as the docker backend. I'm getting the following error after the containers are bounced following running Composer:

    + bin/setup magento.test
    Stopping new-project_app_1           ...
    Stopping new-project_phpfpm_1        ...
    Stopping new-project_redis_1         ...
    Stopping new-project_db_1            ...
    Stopping new-project_elasticsearch_1 ...
    Stopping new-project_rabbitmq_1      ...
    Stopping new-project_redis_1         ... done
    Stopping new-project_elasticsearch_1 ... done
    Stopping new-project_rabbitmq_1      ... done
    Stopping new-project_app_1           ... done
    Stopping new-project_phpfpm_1        ... done
    Stopping new-project_db_1            ... done
    Starting new-project_rabbitmq_1 ...
    Starting new-project_db_1       ...
    Starting new-project_elasticsearch_1 ...
    Starting new-project_redis_1         ...
    Starting new-project_redis_1         ... done
    Starting new-project_db_1            ... done
    Starting new-project_phpfpm_1        ...
    Starting new-project_elasticsearch_1 ... done
    Starting new-project_rabbitmq_1      ... done
    Starting new-project_phpfpm_1        ... done
    Starting new-project_app_1           ...
    Starting new-project_app_1           ... done
    Waiting for connection to Elasticsearch...
    .Could not connect to the Amqp Server.
    

    When I had a look at the logs for the rabbitmq container (which appears to be starting and running), I see:

    
    2021-03-09 16:55:02.653 [info] <0.9.0> Server startup complete; 3 plugins started.
    * rabbitmq_management
    * rabbitmq_management_agent
    * rabbitmq_web_dispatch
    2021-03-09 16:55:07.557 [info] <0.624.0> accepting AMQP connection <0.624.0> (172.23.0.6:36534 -> 172.23.0.4:5672)
    2021-03-09 16:55:07.563 [error] <0.624.0> Error on AMQP connection <0.624.0> (172.23.0.6:36534 -> 172.23.0.4:5672, user: 'guest', state: opening): vhost C:/Program Files/Git/ not found
    2021-03-09 16:55:07.563 [info] <0.624.0> closing AMQP connection <0.624.0> (172.23.0.6:36534 -> 172.23.0.4:5672, vhost: 'none', user: 'guest')
    

    So it's trying to run GIT to pull something, but it's looking for a DOS directory path. I do have GIT installed in C:/Program Files/Git/, but I'm wondering if mount points are confused that it's looking for a DOS path.

    Is the fact that I'm using WSL2 the problem here? Has anyone else got this to work?

    opened by RotateAt60MPH 38
  • Setting up xdebug with WSL2 and VS Code

    Setting up xdebug with WSL2 and VS Code

    Description Hey guys, just followed this documentation and set up an existing Magento 2 2.4+ project succesfully. It all works like a charm, except for the debug function.

    Tried some things:

    • Run bin/xdebug enable
    • Install chrome debug extension and set IDE to PHPStorm
    • Install PHP Debug extension on VS Code as requested ( Installed on the WSL env, not local )
    • Manually created the launch.json and copied the same as it is mentioned on the readme of this project
    • As I already worked with linux-based environments, started the debug function on VS Code typing F5, and it started listening to requests
    • Flushed Magento cache using bin/magento c:f
    • Tried to restart the page, it never stops at any breakpoint
    • Last thing I tried was uninstalling the chrome extension and test it all over again - no success.

    Maybe I'm doing something wrong or forgetting a step, can you help me set xdebug with VSCode within an WSL2 env ?

    help wanted 
    opened by felipebazza 31
  • Xdedug doesnt work

    Xdedug doesnt work

    Description Xdebug doesn't work me Ubuntu 20.20, Phpstorm 2022.2 I implemented all steps from the readme I have a breakpoint in pub/index.php

    did you have similar issues before?

    Steps To Reproduce Screenshot from 2022-10-23 23-21-13 Screenshot from 2022-10-23 23-21-41 Screenshot from 2022-10-23 23-23-21 Screenshot from 2022-10-23 23-23-45 Screenshot from 2022-10-23 23-24-54 Screenshot from 2022-10-23 23-25-31

    Expected Result Xdebug works

    Actual Result Xdebug doenst works

    help wanted question 
    opened by boris1988 27
  • Docker fails on both ElasticSearch, Redis and RabbitMQ

    Docker fails on both ElasticSearch, Redis and RabbitMQ

    I've been using this docker setup for a few years now. But I had some permission issues, and after I ran bin/update, I couldn't restart the containers due to all kinds of issues, so I decided to remove everything and start over with a clean slate on Ubuntu. I tried the one-line install and the manual install, but neither seem to function anymore from bin/setup magento2.test forward. I already checked https://github.com/markshust/docker-magento/issues/442.

    What is happening I can download and start the setup just fine; all services are started normally without issue. First I couldn't connect to Elasticsearch. If I remove --silent from the setup file, it throws; Failed to connect to elasticsearch port 9200: Connection refused

    If I comment out Elasticsearch, RabbitMQ and Redis throw this issue;

    ..........Could not connect to the Amqp Server.
    SQLSTATE[HY000] [2002] Connection refused
    Invalid Redis configuration. Could not connect to Redis server.
    Invalid Redis configuration. Could not connect to Redis server.
    
    In InstallCommand.php line 274:
                                   
      Parameter validation failed  
    
    setup:install [--backend-frontname BACKEND-FRONTNAME] [--enable-debug-logging ENABLE-DEBUG-LOGGING] [--enable-syslog-logging ENABLE-SYSLOG-LOGGING] [--remote-storage-driver REMOTE-STORAGE-DRIVER] [--remote-storage-prefix REMOTE-STORAGE-PREFIX] [--remote-storage-bucket REMOTE-STORAGE-BUCKET] [--remote-storage-region REMOTE-STORAGE-REGION] [--remote-storage-key REMOTE-STORAGE-KEY] [--remote-storage-secret REMOTE-STORAGE-SECRET] [--consumers-wait-for-messages CONSUMERS-WAIT-FOR-MESSAGES] [--amqp-host AMQP-HOST] [--amqp-port AMQP-PORT] [--amqp-user AMQP-USER] [--amqp-password AMQP-PASSWORD] [--amqp-virtualhost AMQP-VIRTUALHOST] [--amqp-ssl AMQP-SSL] [--amqp-ssl-options AMQP-SSL-OPTIONS] [--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] [--db-ssl-key DB-SSL-KEY] [--db-ssl-cert DB-SSL-CERT] [--db-ssl-ca DB-SSL-CA] [--db-ssl-verify] [--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] [--session-save-redis-sentinel-master SESSION-SAVE-REDIS-SENTINEL-MASTER] [--session-save-redis-sentinel-servers SESSION-SAVE-REDIS-SENTINEL-SERVERS] [--session-save-redis-sentinel-verify-master SESSION-SAVE-REDIS-SENTINEL-VERIFY-MASTER] [--session-save-redis-sentinel-connect-retries SESSION-SAVE-REDIS-SENTINEL-CONNECT-RETRIES] [--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] [--cache-backend-redis-password CACHE-BACKEND-REDIS-PASSWORD] [--cache-backend-redis-compress-data CACHE-BACKEND-REDIS-COMPRESS-DATA] [--cache-backend-redis-compression-lib CACHE-BACKEND-REDIS-COMPRESSION-LIB] [--cache-id-prefix CACHE-ID-PREFIX] [--allow-parallel-generation] [--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-password PAGE-CACHE-REDIS-PASSWORD] [--page-cache-redis-compress-data PAGE-CACHE-REDIS-COMPRESS-DATA] [--page-cache-redis-compression-lib PAGE-CACHE-REDIS-COMPRESSION-LIB] [--page-cache-id-prefix PAGE-CACHE-ID-PREFIX] [--lock-provider LOCK-PROVIDER] [--lock-db-prefix LOCK-DB-PREFIX] [--lock-zookeeper-host LOCK-ZOOKEEPER-HOST] [--lock-zookeeper-path LOCK-ZOOKEEPER-PATH] [--lock-file-path LOCK-FILE-PATH] [--document-root-is-pub DOCUMENT-ROOT-IS-PUB] [--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]] [--search-engine SEARCH-ENGINE] [--elasticsearch-host ELASTICSEARCH-HOST] [--elasticsearch-port ELASTICSEARCH-PORT] [--elasticsearch-enable-auth ELASTICSEARCH-ENABLE-AUTH] [--elasticsearch-username ELASTICSEARCH-USERNAME] [--elasticsearch-password ELASTICSEARCH-PASSWORD] [--elasticsearch-index-prefix ELASTICSEARCH-INDEX-PREFIX] [--elasticsearch-timeout ELASTICSEARCH-TIMEOUT] [--cleanup-database] [--sales-order-increment-prefix SALES-ORDER-INCREMENT-PREFIX] [--use-sample-data] [--enable-modules [ENABLE-MODULES]] [--disable-modules [DISABLE-MODULES]] [--convert-old-scripts [CONVERT-OLD-SCRIPTS]] [-i|--interactive] [--safe-mode [SAFE-MODE]] [--data-restore [DATA-RESTORE]] [--dry-run [DRY-RUN]] [--magento-init-params MAGENTO-INIT-PARAMS]
    

    What I already did I did a complete purge of docker, docker-compose, this entire install, rebooted, did a reinstall of everything - fails at the same point each time.

    My system I'm running Kubuntu 21.10, Kernel 5.13.0, 16GB RAM with a i7-1065G7 CPU, so it's no shortage of muscle on my machine I believe. I did do all the extra Linux setup to resolve the hostname, set the vm.max_map_count=262144 etc. On top of this, I had the setup running (albeit with permission issues) before on this same machine for a long time.

    So what is happening? It looks like there are internal connection issues in the container, neither Elasticsearch, RabbitMQ or Redis can connect properly. I'm too novice with Docker to properly figure out how to fix this. I have been Googling around, but I couldn't find a proper fix. The strange thing is, I had this Docker running before on this same machine. Am I correct in thinking there is something wrong in the container, and not my local machine?

    unable to replicate 
    opened by Asitis 25
  • Support for Apple sillicon M1 chips

    Support for Apple sillicon M1 chips

    UPDATE

    I created this fork here for use with macs with m1: https://github.com/luancschmitz/docker-magento-mac-m1

    docker-compose.yml already have the correct versions that work on ARM

    Original Message

    Description

    When trying to run this docker on a mac with Chip m1, the following images are not supported:

    1. precon database
    2. Elastic Search

    Steps To Reproduce

    1. curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
    2. bin/download 2.4.1
    3. bin/setup magento2.test

    The error is displayed

    Expected Result all images are downloaded and a magento 2 instance is created

    Actual Result An error is displayed stating that the images are not supported by the architecture (linux/arm/v8)

    Solution change the image of: elasticseach = "elasticsearch:7.10.1" database = "mariadb:10.4.17"

    hacktoberfest 
    opened by luancschmitz 24
  • setup-ssl fails on Linux

    setup-ssl fails on Linux

    When trying to run the setup-ssl command on Linux it fails for the sudo security add-trusted-cert command as there's no security binary which could be called. I'd assume that's a Mac-only solution.

    help wanted unable to replicate needs confirmation 
    opened by shochdoerfer 19
  • Copying /var/www/html from appdata volume fails

    Copying /var/www/html from appdata volume fails

    I have followed the setup guide using the composer auth method and everything installs and runs great. My problem is that when I attempt to copy the filesystem as described in the README, I get the following:

    C:\Users\NathanS\mage2>docker cp 81a:/var/www/html ./
    symlink \var\www\.composer C:\Users\NathanS\mage2\html\var\composer_home: A required privilege is not held by the client.
    

    I have tried using the command prompt as well as git-bash (Mingw64) both with the same result. I have tried many different things to bypass this issue but have had no success. I also can't find anybody else talking about this problem.

    I am on 64bit Windows 10 Enterprise running as an Administrative user.

    What can I do to get this to work?

    opened by nathanjosiah 19
  • "node" and "npm": executable file not found in $PATH

    Description I need to use npm and nodejs, but it seems that they are not installed.

    Steps To Reproduce

    1. New fresh installation through automated one-liner
    2. exectute bin/npm --version and bin/node --version

    Expected Result No erros.

    Error: Executable file not found in $PATH

    opened by ignaciomella 18
  • onelinesetup - cannot continue due to invalid composer.json

    onelinesetup - cannot continue due to invalid composer.json

    Description While executing onelinesetup I stumble upon the following error:

      "./composer.json" does not contain valid JSON                           
    

    Steps To Reproduce see output of CLI

    ➜  example brew services list
    Name    Status  User Plist
    dnsmasq stopped      
    httpd   stopped      
    mailhog stopped      
    mariadb stopped      
    php     stopped      
    [email protected] stopped      
    [email protected] stopped      
    [email protected] stopped      
    [email protected] stopped      
    [email protected] stopped      
    [email protected] stopped      
    unbound stopped      
    ➜  example ls -la
    total 0
    drwxr-xr-x   2 example  staff    64 Jun  9 15:33 .
    drwxr-xr-x  39 example  staff  1248 Jun  9 15:33 ..
    ➜  example curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.2
    Initialized empty Git repository in /Users/example/dev/sites/example/.git/
    Stopping example_app_1           ... done
    Stopping example_phpfpm_1        ... done
    Stopping example_db_1            ... done
    Stopping example_rabbitmq_1      ... done
    Stopping example_elasticsearch_1 ... done
    Stopping example_redis_1         ... done
    Docker Compose is now in the Docker CLI, try `docker compose up`
    
    Starting example_rabbitmq_1      ... done
    Recreating example_db_1          ... done
    Starting example_elasticsearch_1 ... done
    Starting example_redis_1         ... done
    Recreating example_phpfpm_1      ... done
    Recreating example_app_1         ... done
    
                                                                              
      [Seld\JsonLint\ParsingException]                                        
      "./composer.json" does not contain valid JSON                           
      Parse error on line 1:                                                  
                                                                              
      ^                                                                       
      Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['  
                                                                              
    
    Composer auth has been setup.
    
                                                                              
      [Seld\JsonLint\ParsingException]                                        
      "./composer.json" does not contain valid JSON                           
      Parse error on line 1:                                                  
                                                                              
      ^                                                                       
      Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['  
                                                                              
    
    ➜  example git:(master) ✗ 
    

    Expected Result I was expecting that the setup would continue

    Actual Result The setup stops while not finished

    Which composer.json is the script complaining about?

    opened by hans2103 18
  • Xdebug not working (Ubuntu)

    Xdebug not working (Ubuntu)

    I did all steps from Xdebug & PHPStorm (also video lessons)

    Steps To Reproduce

    1. Enable xdebug (Ubuntu)
    2. sudo iptables -A INPUT -p tcp --dport 9001 -j ACCEPT
    3. phpinfo output port xdebug.client_port | 9003 | 9003
    4. I tested for 9001 and 9003 ports Screenshot from 2021-03-22 21-50-56 Screenshot from 2021-03-22 21-49-35 Screenshot from 2021-03-22 21-49-13 Screenshot from 2021-03-22 21-49-05

    Expected Result Xdebug working

    Actual Result Xdebug not works

    opened by boris1988 17
  • phpmyadmin doesn't match specific platform warning

    phpmyadmin doesn't match specific platform warning

    Description The warning message appears on a fresh install of docker-magento on Apple Silicon machines:

     ⠙ phpmyadmin The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested  0.0s
    

    Steps To Reproduce

    1. Install new docker-magento instance on M1 mac

    Expected Result bin/start starts phpmyadmin without any errors or warnings

    Actual Result ⠙ phpmyadmin The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s

    opened by markshust 0
  • Update all GitHub actions (workflows) to Node16

    Update all GitHub actions (workflows) to Node16

    This warning was recently raised after running the GitHub workflows at https://github.com/markshust/docker-magento/tree/master/.github/workflows

    Examples of warnings https://github.com/markshust/docker-magento/actions/runs/3757523579

    All scripts need to be updated to their most recent versions to use Node16 https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

    help wanted 
    opened by markshust 0
  • Automatically detect search service at setup time

    Automatically detect search service at setup time

    Automatically detect which search service being used from the appropriate --elasticsearch-host value during setup:install, per https://github.com/markshust/docker-magento/pull/834

    help wanted 
    opened by markshust 1
  • Add SSL CA integration support for Firefox Developer Edition

    Add SSL CA integration support for Firefox Developer Edition

    This makes it easier to add more Firefox flavors to the list.

    Also spruce up script:

    • Don't do [[ -d ]], then mkdir -p -- just use mkdir -p (Unfortunately, OSX's install doesn't support -D)
    • Add more messages about what it's doing.
    needs confirmation 
    opened by h3xx 3
  • Invalid Type in compose.healthcheck.yaml in WSL2

    Invalid Type in compose.healthcheck.yaml in WSL2

    Description To Install Magento we have tried Automated Setup as well as manual setup in both cases we are getting the following error

    MicrosoftTeams-image (67)

    MicrosoftTeams-image (68)

    Steps To Reproduce

    1. Installed WSL2
    2. Install docker Version 20.10.21
    3. Install docker-compose version 1.25.0
    4. created project directory: mkdir -p ~/Sites/magento
    5. Download the Docker Compose template: curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash In this step, we are getting following error

    ERROR: The Compose file './compose.healthcheck.yaml' is invalid because: services.phpfpm.depends_on contains an invalid type, it should be an array services.app.depends_on contains an invalid type, it should be an array Failed to start Docker services

    Expected Result It should allow you to install Magento.

    Actual Result Getting Error while executing the curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash command

    opened by Renu05 2
  • Link to readme on failed install of project/dir empty

    Link to readme on failed install of project/dir empty

    This error is too prevalent, and is causing too many GitHub issues to be filed:

    Project directory "/var/www/html/." is not empty error
    

    It is also represented by:

    chmod: cannot access 'bin/magento': No such file or directory
    

    What I'd like is that on bin/start, detect the presence of either of these errors, then show a message to the user that they have a failed install, and to link to https://github.com/markshust/docker-magento#install-fails-because-project-directory-is-not-empty for more information.

    help wanted task 
    opened by markshust 0
Owner
Mark Shust
certified Magento developer & architect, teacher & content creator @mdotacademy
Mark Shust
Docker-magento2 - 🐳 Docker containers with all required Magento 2 dependencies installed available as FPM through Nginx and CLI

Magento 2 Docker A collection of Docker images for running Magento 2 through nginx and on the command line. Quick Start cp composer.env.sample compose

Meanbee 454 Dec 27, 2022
A complete stack for running Symfony 5 into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.

?? Docker + PHP 7.4 + MySQL8.0 + Nginx + Certbot(HTTPS) + Symfony 5 Boilerplate ?? Edited from https://github.com/ger86/symfony-docker version -> http

null 6 Nov 9, 2022
🐋 This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

?? This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

Anton Kliek 1 Jan 26, 2022
Magento 2 Extension to cleanup admin menu and Store > Configuration area by arranging third party extension items.

Clean Admin Menu - Magento 2 Extension It will merge all 3rd party extension's menu items in backend's primary menu to a common menu item named "Exten

RedChamps 109 Jan 3, 2023
Magento 2 module to automatically flush the cache whenever you save something in the System Configuration

Yireo AutoFlushCache Magento 2 module to automatically flush the cache whenever you save something in the System Configuration. Do NOT use this in pro

Yireo 21 May 14, 2022
Magento 2 module for displaying additional information in configuration

AvS_ScopeHint for Magento 2 Displays a hint when a configuration value is overwritten on a lower scope (website or store view). Facts version: 1.0.0-b

Andreas von Studnitz 131 Dec 14, 2022
Import/Export configuration data in Magento 2 via CLI.

ConfigImportExport This module provides new CLI commands for Magento 2 to import/export data in/from core_config_data. This module is inspired by the

semaio 135 Dec 9, 2022
Import/Export configuration data in Magento 2 via CLI.

ConfigImportExport This module provides new CLI commands for Magento 2 to import/export data in/from core_config_data. This module is inspired by the

semaio 117 Mar 23, 2022
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

LimeSoda Interactive Marketing GmbH 73 Apr 1, 2022
Magento n98-magerun module for importing and exporting configuration data

Magento n98-magerun module for importing and exporting configuration data. Import supports hierarchical folder structure and of course different environments.

Zookal 61 Apr 1, 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
Production ready scalable Magento setup utilizing the docker

Magento docker image Requirements This docker image expects 2 other linked containers to work . Mysqldb or Mariadb linked as 'db' Memcached linked as

Paim pozhil 49 Jun 21, 2021
A Magento Development Environment Made of Docker Containers

Docker for Magento 1 Extension Development Tl;dr How do I use this? Clone it. Type docker-compose up -d. Install a Magento Mount your file share. Deve

Michael A. Smith 99 May 10, 2021
Mage2click toolset to create and manage the Magento Docker development environment with mutagen.io file-sync for macOS and native filesystem mounts on Linux.

Mage2click - Magento Docker Toolset Mage2click toolset is a system-wide command-line tool for creating and managing simultaneously running Magento Doc

Mage2click 69 Nov 28, 2022
OSX/Linux Docker containers installer for Magento 2

Magento 2 OSX/Linux Docker Requirements MacOS: Docker, docker-sync, Git Linux: Docker, Docker-compose, Git on Debian based OS (Example: Ubuntu, Linux

Osiozekhai Aliu 54 Dec 10, 2022
Magento 2.4.4 CE docker compose

REQUIREMENTS Docker https://docs.docker.com/desktop/install/windows-install/ Git https://git-scm.com/download/win STOP LOCAL SERVERS (XAMPP, OPENSERVE

null 5 Sep 11, 2022
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

Shivam Mathur 2.4k Jan 6, 2023