-
Notifications
You must be signed in to change notification settings - Fork 8
Install Magento
Generate Docker composition from the selected template and install Magento.
Supported Magento versions:
- 2.3.7
- 2.4.2
- 2.4.3
- 2.4.4-pX (all patches except the first 2.4.4 release)
- 2.4.5 and above
The tool includes templates for older Magento versions if you need Docker for them, but those versions are not installable anymore. Composer is unable to pull packages for those versions, and Magento installation fails.
This command deploys clean Magento instance of the selected version.
Magento will be configured to use Varnish and Elasticsearch if they are present in the composition.
Magento will not be configured to use Redis! Need to implement this if possible.
Example usage:
php bin/dockerizer magento:setup <version>You can enter all required parameters in the interactive mode. Passing all parameters as command options is also possible and works better for automation.
Advanced usage with parameters:
php bin/dockerizer magento:setup 2.4.4 -f \
--domains='my-magento-project.local www.my-magento-project.local' \
--template=magento_2.4.4_nginx_varnish_apache \
--required-services='php_8_1_apache,mariadb_10_4_persistent,elasticsearch_7_16_3' \
--optional-services=redis_6_2 \
--with-environment=prodNote that Magento is running in the production mode, e.g. without dev tools. This is preferable for QA, CI/CD, etc.
Developers should restart the composition in the developer mode to enable dev tools:
cd ./.dockerizer/my-magento-project.local-prod/
docker-compose -f docker-compose.yaml -f docker-compose-dev-tools.yaml up -d --force-recreate-
magento-version(first argument): Magento version to install (2.4.6,2.3.7-p3, etc.)
You can pass any additional options from composition:build-from-template to this command.
Supported Magento versions: 2.0.2+ (yes, that old versions work well).
Every template includes software versions according to the Magento system requirements and Release Notes. We highly recommend selecting the services and software versions that will match your server. If the application server has different software versions than listed in the template then, most likely, you should review and change the server software to guarantee Magento stability. You can thought edit the composition after it is generated.
Magento is configured to use the following services if available:
- Varnish if any container containing
varnishis available; - ElasticSearch if any container containing
elasticsearchis available;
IMPORTANT!
Redis is not configured automatically. RabbitMQ: to be implemented. Your pull requests are appreciated!
Currently supported web server configurations are:
- Apache
- Nginx + Varnish + Apache
Magento installation command:
php bin/magento setup:install --admin-firstname='Magento' --admin-lastname='Administrator' \
--admin-email='email@example.com' --admin-user='development' --admin-password=$escapedAdminPassword \
--base-url=$baseUrl --base-url-secure=$baseUrl \
--db-name=$dbName --db-user='$dbUser' --db-password=$dbPassword \
--db-prefix=$tablePrefix --db-host=mysql \
--use-rewrites=1 --use-secure=1 --use-secure-admin=1 \
--session-save=files --language=en_US --sales-order-increment-prefix='ORD$' \
--currency=USD --timezone=America/Chicago --cleanup-databaseYou will get:
- All website-related files stored to
${DOCKERIZER_PROJECTS_ROOT_DIR}<domain>/ - Docker composition up and running (without dev tools)
-
docker-composefiles and mounted files in the./.dockerizer/my-magento-project.local/directory of the project - Magento 2 installed without Sample Data (can be installed from inside the container if needed). Web root and respective configurations are set to the
./pub/folder - Self-signed SSL certificate (thanks to mkcert)
- Traefik reverse-proxy automatically configured to serve this container and handle SSL certificate
- Domain(s) added to your
/etc/hostsif not there yet (this is why you may want to grant write permission on the/etc/hosts) - Admin Panel path is displayed after installing Magento
- Admin Panel login/password are:
development/q1w2e3r4(custom passwords will be added soon). We recommend changing it to the more strict one. - Magento is configured to use Varnish and Elasticsearch. Redis is not configured automatically!
If the SSL certificate is not valid in Chrome/Firefox when you first run the app URL then run the following command and restart the browser:
mkcert -installBy default, two docker-compose files are generated:
-
docker-compose.yaml: basic configuration that reflects production environment and can be used in the build environment -
docker-compose-prod.yaml: development settings and tools for production environment (another PHP container with xDebug, phpMyAdmin, etc.)
Parameters --elasticsearch-host and --search-engine are added depending on the selected services and Magento version.
Post-installation configurations are:
-
catalog/search/elasticsearch{$elasticsearchMajorVersion}_server_hostname":elasticsearch(Magento < 2.4.0) -
catalog/search/engine:elasticsearch{$elasticsearchMajorVersion}(Magento < 2.4.0) -
web/unsecure/base_static_url:http://$mainDomain/static/(Magento < 2.4.2) -
web/unsecure/base_media_url:http://$mainDomain/media/(Magento < 2.4.2) -
web/secure/base_static_url:https://$mainDomain/static/(Magento < 2.4.2) -
web/secure/base_media_url:https://$mainDomain/media/(Magento < 2.4.2) -
dev/static/sign:1 -
dev/js/move_script_to_bottom:1 -
dev/css/use_css_critical_path:1 -
system/full_page_cache/caching_application:2 -
system/full_page_cache/varnish/access_list:localhost,php -
system/full_page_cache/varnish/backend_host:php -
system/full_page_cache/varnish/backend_port:80 -
system/full_page_cache/varnish/grace_period:300
Additionally, setup:config:set --http-cache-hosts= is set to configure app/etc/env.php with Varnish host and port:
varnish-cache:80 or varnish-cache:6081 (Varnish 4 only).
Any operation like running Composer, PHP scripts or Magento commands, etc. MUST be performed only inside the container.
In the same way, you must use MySQL client or mysqldump inside the MySQL container.
See an article about Bash aliases that will make your development easier and bring fun to it!
- docker:mysql:connect
- docker:mysql:export-db
- docker:mysql:import-db
- docker:mysql:upload-to-aws
- docker:mysql:generate-metadata
- docker:mysql:reconstruct-db
- docker:mysql:test-metadata
- MacOS and Docker Desktop support
- Bash aliases
- Install Symfony with Dockerizer
- Running-apps-with-existing-Docker-compositions
- Limitations
- Building MySQL images with DB: how it works
- Configure AWS Lambda
- Gitlab pipeline to build images
- Managing AWS S3 access
- Using AWS credentials with Dockerizer
- Access management cheat-sheet
- FAQ