Docker CLI Containers

The following CLI containers, most of which are based on a PHP-CLI version 7 image, provide magento-cloud and ece-tools commands to perform file system operations and interact with the application:

  • build—extends the CLI container to perform operations with writable filesystem, similar to the build phase
  • deploy—extends the CLI container to use read-only file system, similar to the deploy phase
  • cron—extends the CLI container to run cron
  • node—based on node image, used for NPM activities

For example, you can check the state of the your project using the ideal-state wizard:

Run the ece-tools ideal-state command.

1
docker-compose run deploy ece-command wizard:ideal-state

Sample response:

1
2
 - Your application does not have the "post_deploy" hook enabled.
The configured state is not ideal

All build and deploy processes are defined and configured using ece-tools and the Magento Cloud template.

CLI container commands

These commands are available in the Magento Cloud Docker environment:

Command Target Containers Notes
cloud-build build Build the application in production mode, configured by the build hook in the .magento.app.yml file
cloud-deploy deploy Deploy the application, configured by the deploy hook in the .magento.app.yml file
cloud-post-deploy deploy Run post deploy hooks, configured by the post deploy hook in the .magento.app.yml file
ece-command deploy Run [ece-tools CLI commands]
magento-command deploy Run bin/magento commands
mftf-command deploy Run MFTF command for testing
run-cron cron Run cron jobs

To understand the processing for each command, review the scripts in the Magento Cloud Docker GitHub repository.

Build container

Container name: build
Docker base image: magento/magento-cloud-docker-php, which is based on the Docker php image

The Build container mimics the behavior of the Magento Cloud build process so that testing the build and deploy process is as close to testing in production as possible.

You can also run build commands manually from the build container to perform individual steps from the build process. For example, you can run the following command to deploy static content.

1
docker-compose run build magento-command setup:static-content:deploy

Cron container

Container name: cron
Docker base image: magento/magento-cloud-docker-php, which is based on the Docker php image

The Cron container runs operations in the background immediately after the Docker environment starts. This container uses the cron configuration defined in the crons property of the .magento.app.yaml file. This container has no custom configuration.

For details on managing cron jobs in the Cloud Docker environment, see Manage cron jobs.

Deploy container

Container name: deploy
Docker base image: magento/magento-cloud-docker-php, which is based on the php Docker image

The Deploy container mimics the Magento Cloud deploy process so that testing the build and deploy process is as close to testing in production as possible.

You can run build and deploy commands manually from the deploy container. The following example reindexes the Magento store:

1
docker-compose run deploy magento-command index:reindex

Node container

Container name: node
Docker base image: node

The Node container is based on the official Node Docker image. You can use the container to install NPM dependencies, such as Gulp, or run any Node-based command line tools.