magento / magento-cloud-docker

All Submissions you make to Magento Inc. (“Magento") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here: https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html
Open Software License 3.0
256 stars 192 forks source link

build service networks isolated magento-build network #340

Closed andreidragutu closed 2 years ago

andreidragutu commented 2 years ago

Preconditions

  1. Docker Desktop 4.3.2, Engine 20.10.11, Compose 1.29.2 on macOS Monterey Apple Silicon (M1) - but not limited to this environment
  2. Magento Commerce 2.4.3-p1, php 7.4, MariaDB 10.4

Steps to reproduce

  1. Run docker-compose run --rm build cloud-build
  2. After [2022-01-25 13:35:10] NOTICE: Validating configuration
  3. [2022-01-25 13:35:10] NOTICE: End of validation
  4. [2022-01-25 13:35:10] NOTICE: Reconciling installed modules with shared config. [2022-01-25 13:35:16] ERROR: [11] The command "php ./bin/magento module:enable --all --ansi --no-interaction '-v'" failed. In Abstract.php line 144:

    [Zend_Db_Adapter_Exception (2002)]
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

This seems to be because the build service it's on an isolated network and cannot communicate with DB service.

Expected result

  1. [2022-01-25 15:03:41] INFO: Scenario(s) finished Building complete.
Screenshot 2022-01-25 at 17 19 53

This is how it looks like after I changed the network to magento instead of magento-build in docker-compose.yml

Actual result

[Zend_Db_Adapter_Exception (2002)]
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known 1. [

Screenshot 2022-01-25 at 17 16 10

](url)

This is how it looks if the network is set to magento-build in docker-compose.yml

BaDos commented 2 years ago

Hi @andreidragutu It is expected behavior that build phase uses the isolated network. MCD emulates the real Magento Cloud. Build phase does not have access to other services such as DB, Redis, ES, etc Need to check modules, because during module:enable command modules should not connect to any services.

BaDos commented 2 years ago

It is not an MCD bag.