Launch Docker configuration

The ece-tools package v2002.0.13 or later deploys to a read-only file system in the Docker container, which mirrors the read-only file system deployed in the Production environment. You can use the docker:build command in the ece-tools package to generate the Docker compose configuration and deploy Magento Commerce Cloud in a Docker container.

Magento Commerce Cloud references the and .magento/services.yaml configuration files to determine the services you need. When you start the Docker configuration generator, you can overwrite a service version with the following optional parameters:

Service Key Default value Possible values
PHP --php 7.1 7.0, 7.1, 7.2
NGINX --nginx latest 1.9, latest
MariaDB --db 10 10.0, 10.1, 10.2
Elasticsearch --es 2.4 1.7, 2.4, 5.2, 6.5
RabbitMQ --rmq 3.5 3.5, 3.7
Redis --redis 3.2 3.0, 3.2, 4.0, 5.0

This version also provides a docker:config:convert command to convert PHP configuration files to Docker ENV files.


You must have the following software installed on your local workstation:

Before you begin, you must add the following hostname to your /etc/hosts file: magento2.docker

To launch Docker:

  1. Download a Magento application template from the Magento Cloud repository. Be careful to select the branch that corresponds with the Magento version.

  2. Add your Magento access credentials to the auth.json file.

  3. Install the template dependencies.

    composer install
  4. In your local environment, start the Docker configuration generator. You can use the service keys, such as --php, to specify a version.

    ./vendor/bin/ece-tools docker:build
  5. Copy the raw configuration files.

    cp docker/config.php.dist docker/config.php
    cp docker/global.php.dist docker/global.php
  6. Optional: Configure the Docker global variables in the docker/global.php file. For example, you can enable and configure Xdebug.

  7. Convert the PHP configuration files to Docker ENV files.

     ./vendor/bin/ece-tools docker:config:convert

    This command generates the following Docker ENV files:

    • docker/config.env
    • docker/global.env

    The ece-tools v2002.0.12 package does not support the docker:config:convert command.

  8. Build files to containers and run in the background.

    docker-compose up -d
  9. Install Magento in your Docker environment.

    • Build Magento in the Docker container:

        docker-compose run build cloud-build
    • Deploy Magento in the Docker container:

        docker-compose run deploy cloud-deploy

    For ece-tools v2002.0.12, install Magento with the docker-compose run cli magento-installer command.

  10. Access your local Magento Cloud template by opening one of the following secure URLs in a browser:

To stop containers and restore them afterwards:

Suspend containers to continue your work later.

docker-compose stop

Start containers from suspended state.

docker-compose start

To stop and remove the Docker configuration:

Remove all components of your local Docker instance including containers, networks, volumes, and images.

docker-compose down -v