Mark Shust's Docker Configuration for Magento

Last update: Aug 12, 2022

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

GitHub

https://github.com/markshust/docker-magento
Comments
  • 1. 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!

    Reviewed by jagwire16 at 2016-01-10 04:25
  • 2. 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?

    Reviewed by RotateAt60MPH at 2021-03-09 17:09
  • 3. 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?

    Reviewed by Asitis at 2022-01-31 11:09
  • 4. 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"

    Reviewed by luancschmitz at 2021-02-04 21:12
  • 5. 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.

    Reviewed by shochdoerfer at 2020-02-08 18:25
  • 6. 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?

    Reviewed by nathanjosiah at 2017-02-02 18:40
  • 7. "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

    Reviewed by ignaciomella at 2022-04-25 00:03
  • 8. 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?

    Reviewed by hans2103 at 2021-06-09 13:41
  • 9. 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

    Reviewed by boris1988 at 2021-03-22 19:51
  • 10. Debugger is not triggering on breakpoints after setting up

    Hello! First of all, I want to thank you for this great docker configuration. I find it very handy and switched most of the projects I'm working on to it. However, I can't set up my debugger using this instruction: https://github.com/markshust/docker-magento#xdebug--phpstorm

    Description Can't set up my debugger

    Steps To Reproduce Go through the steps of this instruction https://github.com/markshust/docker-magento#xdebug--phpstorm

    Expected Result PHPStorm will stop on the breakpoints

    Actual Result PHPStorm is not stopping, I can see waiting for incoming connections with ide key 'PHPSHORM' text

    ===

    bin/cli php -v output:

    PHP 7.4.8 (cli) (built: Jul 22 2020 09:39:30) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
        with the ionCube PHP Loader + ionCube24 v10.4.1, Copyright (c) 2002-2020, by ionCube Ltd.
        with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
        with blackfire v1.36.0~linux-x64-non_zts74, https://blackfire.io, by Blackfire
    

    PHP config: image

    PHP server: image

    Debug configuration: image

    Xdebug helper extension options: image

    Debug and DBGp Proxy ports are set to 9001 inside PHPStorm settings

    Reviewed by gosteev at 2020-11-28 17:55
  • 11. Missing write permissions

    So I reinstalled everything from repo.

    When I do ./bin/setup I get the following errors

                                                         
      [Exception]                                        
      Missing write permissions to the following paths:  
      /var/www/html/var/composer_home/composer.lock      
      /var/www/html/var/composer_home/cache              
      /var/www/html/var/composer_home/vendor             
      /var/www/html/var/composer_home/.htaccess     
    

    and many of these

    chmod: changing permissions of 'var/composer_home/vendor/symfony/polyfill-mbstring/Mbstring.php': Operation not permitted
    chmod: changing permissions of 'var/composer_home/vendor/symfony/polyfill-mbstring/bootstrap.php': Operation not permitted
    chmod: changing permissions of 'var/composer_home/vendor/symfony/polyfill-mbstring/README.md': Operation not permitted
    

    and this

    
      [Symfony\Component\Console\Exception\CommandNotFoundException]  
      There are no commands defined in the "deploy:mode" namespace.   
                                                                                                                                        
      [Symfony\Component\Console\Exception\CommandNotFoundException]  
      There are no commands defined in the "indexer" namespace.       
    
    Reviewed by avremel at 2018-01-15 21:48
  • 12. Fatal Error abstract

    Description Fatal error: Class Magento\Setup\Mvc\Bootstrap\InitParamListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Laminas\ServiceManager\Factory\FactoryInterface::__invoke) in /var/www/html/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php on line 32

    Steps To Reproduce Trying to run existing project and this error comes at this step ->

    Import app-specific environment settings:

    bin/magento app:config:import

    Expected Result Pass

    Actual Result Fatal Error

    Reviewed by 3rsin3rgul at 2022-08-06 23:21
  • 13. Composer ownership problem

    Description Hi, i'm trying to import an existing project that is build in Magento 2.4.3-p1 version. During the process that will be described below i receive this error:

    (a lot of attempts above of changing the ownership of the files) chown: changing ownership of '/var/www/.composer/cache/files': Operation not permitted chown: changing ownership of '/var/www/.composer/cache': Operation not permitted chown: changing ownership of '/var/www/.composer/config.json': Operation not permitted chown: changing ownership of '/var/www/.composer': Operation not permitted chown: changing ownership of '/var/www/.ssh/id_rsa': Operation not permitted chown: changing ownership of '/var/www/.ssh/known_hosts': Operation not permitted Filesystem ownerships fixed.

    [RuntimeException]
    Could not read /var/www/.composer/config.json

    file_get_contents(/var/www/.composer/config.json): failed to open stream: Permission denied

    create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [] [] []

    cp: cannot open '/var/www/.composer/auth.json' for reading: Permission denied

    I've already tried changing the ownership of the current directorie (/var/www/) with the command: sudo chown -R pc07:pc07 .

    Steps To Reproduce in your root type those commands below: mkdir Sites cd Sites mkdir "my_store" cd "my_store"

    now you type: curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash and bin/download magento 2.4.3-p1 community

    and the error appears.

    Reviewed by guilhermes027 at 2022-08-01 15:12
  • 14. Request for help importing large database

    Description

    Hi, Mark — first of all, thank you so much for this repo. It's the best one-step Magento install I've come across.

    I am not reporting a bug but asking for an assist. I'm still fairly new to Docker, and I'm not quite connecting the dots when it comes to certain concepts. I know you must be busy, so huge thanks in advance.

    Steps To Reproduce

    I'm trying to import a large database from the command line.

    I've done this many times before in other environments, but the concepts of Docker are confusing me, haha.

    In short: Where on my the hard drive for my local system — ie the computer I'm physically working on — do I put the SQL.gz file, and where should I run the mysql import command? Should I open the shell for the magento mariadb container?

    Thank you!

    Expected Result

    Actual Result

    Reviewed by robert-j-peterson at 2022-07-27 22:02
  • 15. updates and fixes to the readme about mailcatcher

    Hi @markshust,

    Came across your repository, awesome project! Thanks a lot for creating and sharing.

    I found that the mailcatcher hint in the readme was not correct about using port 1080 for sending. For sending it should use port 1025 (have tested that). I also tried to make that sentence be a bit more explanatory (in my best english 🙈).

    Last thing I found in this part was the link to the Mageplaza module, the link and the name of the link where in the wrong order.

    Thanks!

    Reviewed by joggienl at 2022-07-27 08:05
  • 16. After setup markshust/docker-magento, local projects are not working

    Description:

    I have followed the steps to install and set up a new project from Automated Setup (New Project), and the project setup was done successfully with sample data. After that to run my local projects I tried to open my local URL(http://local.ce243.com/), the url not working and gives the following error: not-working-project

    So I start apache2, mysql, elasticsearch, and redis-server services using the following command, but no luck. It shows the same above error:

    sudo service apache2 start && sudo service mysql start && sudo service elasticsearch start && sudo service redis-server start

    Please let me know how to overcome this issue. Thanks in anticipation.

    Reviewed by Mage2developer at 2022-07-26 07:21
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

Jun 9, 2022
A complete stack for running Symfony 5 into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.
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

Jun 10, 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.

Jan 26, 2022
Magento 2 Extension to cleanup admin menu and Store > Configuration area by arranging third party extension items.
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

Aug 14, 2022
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

May 14, 2022
Magento 2 module for displaying additional information in configuration
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

Jul 29, 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

Jun 23, 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

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.

Apr 1, 2022
Magento n98-magerun module for importing and exporting configuration data
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.

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

Jun 9, 2022
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

May 10, 2021
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

Jun 21, 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 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

Jun 6, 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

Jul 24, 2022
Magento 2.4.4 CE docker compose
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

Aug 12, 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.

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

Aug 16, 2022