Developer mode

Developer mode supports an active development environment with full, writable filesystem permissions. This option builds the Docker environment in developer mode and verifies configured service versions. On macOS and Windows systems, performance is slower in developer mode because of additional file synchronization operations. However, you can improve performance by using either mutagen or docker-sync file synchronization tools when you generate the docker-compose.yml configuration file. See Synchronizing data in Docker.

The ece-tools version 2002.0.18 and later supports developer mode.

Large files (>1 GB) can cause a period of inactivity. DB dumps and archive files—ZIP, SQL, GZ, and BZ2—are not necessary to sync. You can find exclusions to these file types in the docker-sync.yml and files.

See Configure Docker for additional information about Docker prerequisites and using the Magento Cloud Docker environment.

To launch the Docker environment in developer mode:

  1. Download a Magento application template from the Magento Cloud repository and copy the files to your Magento Cloud Docker project directory. Be careful to select the branch that corresponds with the Magento version.

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

  3. Run the installation script, to install template dependencies and add the default hostname to your /etc/hosts file.

    curl<magento-cloud-docker-package-version>/bin/ | bash

    For <package-version>, use the latest release of the magento/magento-cloud-docker.

    You can customize the options for the initialization script your Docker environment. For example, you can specify the PHP version (default is 7.2) and the Magento Cloud Docker Docker image (default 1.1). We recommend using the latest version. Run the following command to see the available options:

    curl<magento-cloud-package-version>/bin/ | bash -s -- --help
  4. On macOS or Windows hosts, install the selected file synchronization tool:

  5. In your local environment, generate the Docker Compose configuration file. You can use the service keys, such as --php, to specify a version.

    ./vendor/bin/ece-docker build:compose --mode="developer"

    If required, set the option for synchronizing data in Docker. For example:

    ./vendor/bin/ece-docker build:compose --mode="developer" --sync-engine="mutagen"

    You can further customize the Docker Compose configuration file by adding additional options to the build:compose command. For example, you can set the software version for a service, or add Xdebug configuration. See service keys.

  6. Optional: If you have a custom PHP configuration file, copy the default configuration DIST file to your custom configuration file and make any necessary changes.

    cp .docker/config.php.dist .docker/config.php
  7. If you selected docker-sync for file synchronization, start the file synchronization.

    For the docker-sync tool:

    docker-sync start

    If this is the first installation, expect to wait a few minutes for file synchronization.

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

    docker-compose up -d
  9. If you selected mutagen for file synchronization, start the file synchronization.

    bash ./

    If you host your Docker environment on Windows and the session start fails, update the file to change the value for the --symlink-mode option to portable.

  10. Install Magento in your Docker environment.

    • For Magento version 2.4 and 2.4.1 only, run the following command to apply patches before you deploy.

      docker-compose run --rm deploy php ./vendor/bin/ece-patches apply
    • Deploy Magento in the Docker container.

      docker-compose run --rm deploy cloud-deploy
      docker-compose run --rm deploy magento-command deploy:mode:set developer
    • Run post-deploy hooks.

       docker-compose run --rm deploy cloud-post-deploy

      Developer mode does not require the build operation.

  11. Configure and connect Varnish.

    docker-compose run --rm deploy magento-command config:set system/full_page_cache/caching_application 2 --lock-env
    docker-compose run --rm deploy magento-command setup:config:set --http-cache-hosts=varnish
  12. Clear the cache.

    docker-compose run --rm deploy magento-command cache:clean
  13. Access the local Magento Cloud template by opening one of the following URLs in a browser:

    • http://magento2.docker

    • https://magento2.docker