Start the Docker environment

Production mode is the default configuration setting for launching the Docker environment with read-only filesystem permissions. This option builds the Docker environment in production mode and verifies configured service versions.

See Configure Docker for details about customizing the Docker configuration.

Prerequisites:

Complete the installation steps.

To launch the Docker environment in production mode:

  1. In your local environment, start the Docker configuration generator. You can use the service configuration options, such as --php, to specify a version.

    1
    
    ./vendor/bin/ece-docker build:compose
    
  2. 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.

    1
    
    cp .docker/config.php.dist .docker/config.php
    
  3. Build files to containers and run in the background.

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

    • Build Magento in the Docker container.

      1
      
      docker-compose run --rm build cloud-build
      
    • Deploy Magento in the Docker container.

      1
      
      docker-compose run --rm deploy cloud-deploy
      
    • Run post-deploy hooks.

      1
      
      docker-compose run --rm deploy cloud-post-deploy
      
  5. Configure and connect Varnish.

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

    1
    
    docker-compose run --rm deploy magento-command cache:clean
    
  7. Optional: Restart services if the static content does not synchronize with all images after generation on build phase.

    1
    
    docker-compose restart
    
  8. Access the local Magento Cloud template by opening one of the following URLs in a browser:

    • http://magento2.docker

    • https://magento2.docker

  9. Use the default credentials to log in to the Admin (https://magento2.docker/admin).

    • username = Admin
    • password = 123123q
  10. Access the default email service: http://magento2.docker:8025