Cloud Docker for Commerce uses Docker Compose to build and deploy Adobe Commerce to a multi-container Docker application. You can generate the Docker Compose configuration to build and deploy Docker from the following sources:
- Adobe Commerce on cloud infrastructure project configuration files for Cloud projects
- Unified configuration for On-premises projects
- CLI configuration using
ece-docker build:composecommand options to override configuration values at runtime
- Custom Docker Compose configuration file supports installation for both Cloud and On-premises projects
When you build the Docker Compose configuration file, the
ece-docker build:compose command overwrites the existing
docker-compose.yml configuration file. You can save customizations for the Docker Compose configuration in a
docker-compose.override.yml file. If the
docker-compose.override.yml file is present, then the override configuration merges with the base configuration. See Override configuration.
Run Composer with Docker
You can run composer using the
docker command before you create the container instance. This technique is useful to create an application instance during the CI/CD build process, or even during first time set up.
When you run composer with Docker commands, you must use the Docker Hub PHP Image Tag that matches the Adobe Commerce application version. The following example uses PHP 7.3. You run this command from the project root directory.
1 docker run -it -v $(pwd):/app/:delegated -v ~/.composer/:/root/.composer/:delegated magento/magento-cloud-docker-php:7.3-cli-1.1 bash -c "composer install&&chown www. /app/"
This command passes in the current working directory as
/app/, includes composer from
~/.composer/, and runs the
composer install command in the container. After this set up, the command fixes the permissions on the files that have been added or changed.
Update Composer for Docker
To update the Composer version in Cloud Docker, add the
COMPOSER_VERSION variable to your
.docker/config.env file with the version you want to use. For example, to use Composer 2.x with Adobe Commerce >=2.4.2:
When you build your Docker image with this variable, Cloud Docker uses this version to run
composer self-update $COMPOSER_VERSION for your environment.
Run Docker on a custom host and port
Sometimes you might want to run Docker on a different host and port, for example if you need more than one Docker instance.
To configure the custom host and port, add the
port options to the
1 ./vendor/bin/ece-docker build:compose --host=magento2.test --port=8080
You must also add or update the custom host name in your
1 127.0.0.1 magento2.test
Alternatively, you can run the following command to add it to the file:
1 echo "127.0.0.1 magento2.test" | sudo tee -a /etc/hosts
Set up email
The default Cloud Docker for Commerce configuration includes the MailHog service as a replacement for the Sendmail service. Sendmail can cause performance issues in the local Docker environment.
After you start the Docker environment, go to the following URL to access the MailHog service and view outgoing emails: