You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

Docker container architecture

Magento Commerce Cloud provides a Docker environment option for those who use their local environment for development, test, or automation tasks. The Magento Commerce Cloud Docker environment requires three, essential components: a Magento Commerce v2 template, Docker Compose, and the Magento Commerce Cloud ece-tools package. See the instructions in Launch Docker.

The Magento Cloud Docker repository contains build information for the following Docker containers.

Database container

The database container is based on the mariadb image.

  • Port: 3306
  • Volumes:
    • /var/lib/mysql
    • ./docker/mysql

To import a database dump:

Place the SQL file into the .docker/mysql/docker-entrypoint-initdb.d folder.

The ece-tools package imports and processes the SQL file the next time you build and start the Docker environment using the docker-compose up command.

Although it is a more complex approach, you can use GZIP by sharing the .sql.gz file using the .docker/mnt directory and importing it inside the Docker container.

CLI containers

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

  • 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

    • The setup:cron:run and cron:update commands are not available on Cloud and Docker for Cloud environment
    • Cron only works with the CLI container to run the ./bin/magento cron:run command

To run the ece-tools ideal-state command:

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

Sample response:

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

Cron container

The Cron container is based on PHP-CLI images, and executes operations in the background immediately after the Docker environment start. It uses the cron configuration defined in the crons property of the .magento.app.yaml file.

To view the cron log:

1
docker-compose run deploy bash -c "cat /app/var/cron.log"

Node container

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

PHP-FPM container

The PHP-FPM container is based on the magento/magento-cloud-docker-php image.

  • Port: 9000
  • Read-only volumes:
    • /app
    • /app/vendor
    • /app/generated
    • /app/setup
  • Read/Write volumes:
    • /app/var
    • /app/app/etc
    • /app/pub/static
    • /app/pub/media

Web container

The web container works with the PHP-FPM to serve PHP code, the DB image for the local database, and the Varnish image to send requests and cache the results.

Varnish container

The Varnish container is based on the magento/magento-cloud-docker-varnish image. Varnish works on port 80.

TLS container

The TLS termination proxy container, based on the magento/magento-cloud-docker-tls image, facilitates the Varnish SSL termination over HTTPS.

Service containers

Service Image
ElasticSearch magento/magento-cloud-docker-elasticsearch
NGINX magento/magento-cloud-docker-nginx
RabbitMQ rabbitmq
Redis magento/magento-cloud-docker-redis

See the service version values available for use when launching Docker.

Sharing data between host machine and container

You can share files easily between your machine and a Docker container by placing the files in the .docker/mnt directory. You can find the files in the /mnt directory the next time you build and start the Docker environment using the docker-compose up command.

Sendmail service

You can send emails from your Docker environment when you enable sendmail in the docker-compose.yml configuration file:

1
ENABLE_SENDMAIL=true