Skip to content

Magento Cloud Docker container mount don’t load files

Main Issue

I’m trying to implement an automated Magento deployment process by utilizing the Magento Cloud Docker solution.
Current flow consists of the following steps:

  1. composer create-project
  2. composer require magento/ece-tools magento/magento-cloud-docker
  3. bash init-docker.sh --php 8.3 --image 1.4.0 --host magento-website.docker --add-host false
  4. composer update
  5. Tweak docker-compose for tls container to make it compatible with the nginx-proxy
  6. docker compose up -d
  7. docker compose run --rm build cloud-build

The problem begins on the step 7 with the following error:

file_put_contents(/app/app/etc/vendor_path.php): Failed to open stream: No
such file or directory

I’ve tried to inspect which files are located in the deploy container but got an empty files list:
no files in the /app

Then I tried to see the size of the whole Magento under the /app dir:
size of the /app

What’s worse, is that this issue does not appear everytime, but rather appears periodically for some time long
Can anybody help?

Project Setup

docker-compose.yml:

# ./vendor/bin/ece-docker 'build:compose' --mode=production --host 'magento-website.docker'
version: '2.1'
services:
  db:
    hostname: db.magento-website.docker
    image: 'mariadb:10.4'
    shm_size: 2gb
    environment:
      - MYSQL_ROOT_PASSWORD=magento2
      - MYSQL_DATABASE=magento2
      - MYSQL_USER=magento2
      - MYSQL_PASSWORD=magento2
    ports:
      - '3306'
    volumes:
      - '.docker/mnt:/mnt:rw,delegated'
      - 'quick-forms-magento-db:/var/lib/mysql'
    healthcheck:
      test: 'mysqladmin ping -h localhost -pmagento2'
      interval: 30s
      timeout: 30s
      retries: 3
    networks:
      magento:
        aliases:
          - db.magento-website.docker
  redis:
    hostname: redis.magento-website.docker
    image: 'redis:6.0'
    volumes:
      - /data
    ports:
      - 6379
    sysctls:
      net.core.somaxconn: 1024
    ulimits:
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000
    healthcheck:
      test: 'redis-cli ping || exit 1'
      interval: 30s
      timeout: 30s
      retries: 3
    networks:
      magento:
        aliases:
          - redis.magento-website.docker
  opensearch:
    hostname: opensearch.magento-website.docker
    image: 'magento/magento-cloud-docker-opensearch:2.5-1.4.0'
    ulimits:
      memlock:
        soft: -1
        hard: -1
    environment:
      - cluster.name=docker-cluster
      - discovery.type=single-node
      - discovery.seed_hosts=opensearch
      - bootstrap.memory_lock=true
      - DISABLE_SECURITY_PLUGIN=true
    networks:
      magento:
        aliases:
          - opensearch.magento-website.docker
  fpm:
    hostname: fpm.magento-website.docker
    image: 'magento/magento-cloud-docker-php:8.3-fpm-1.4.0'
    extends: generic
    volumes:
      - '.:/app:ro,delegated'
      - 'quick-forms-vendor:/app/vendor:ro,delegated'
      - 'quick-forms-generated:/app/generated:ro,delegated'
      - 'quick-forms-var:/app/var:rw,delegated'
      - 'quick-forms-app-etc:/app/app/etc:rw,delegated'
      - 'quick-forms-pub-media:/app/pub/media:rw,delegated'
      - 'quick-forms-pub-static:/app/pub/static:rw,delegated'
      - '.docker/mnt:/mnt:rw,delegated'
    networks:
      magento:
        aliases:
          - fpm.magento-website.docker
    depends_on:
      db:
        condition: service_healthy
  web:
    hostname: web.magento-website.docker
    image: 'magento/magento-cloud-docker-nginx:1.24-1.4.0'
    extends: generic
    volumes:
      - '.:/app:ro,delegated'
      - 'quick-forms-vendor:/app/vendor:ro,delegated'
      - 'quick-forms-generated:/app/generated:ro,delegated'
      - 'quick-forms-var:/app/var:rw,delegated'
      - 'quick-forms-app-etc:/app/app/etc:rw,delegated'
      - 'quick-forms-pub-media:/app/pub/media:rw,delegated'
      - 'quick-forms-pub-static:/app/pub/static:rw,delegated'
      - '.docker/mnt:/mnt:rw,delegated'
    environment:
      - WITH_XDEBUG=0
      - NGINX_WORKER_PROCESSES=1
      - NGINX_WORKER_CONNECTIONS=1024
    networks:
      magento:
        aliases:
          - web.magento-website.docker
    depends_on:
      fpm:
        condition: service_started
  varnish:
    hostname: varnish.magento-website.docker
    image: 'magento/magento-cloud-docker-varnish:6.6-1.4.0'
    volumes:
      - './varnish.service:/lib/systemd/system/varnish.service'
    networks:
      magento:
        aliases:
          - varnish.magento-website.docker
    depends_on:
      web:
        condition: service_started
  tls:
    hostname: tls.magento-website.docker
    image: 'magento/magento-cloud-docker-nginx:1.24-1.4.0'
    extends: generic
    networks:
      - magento
      - shared-network
    environment:
      - NGINX_WORKER_PROCESSES=1
      - NGINX_WORKER_CONNECTIONS=1024
      - UPSTREAM_HOST=varnish
      - UPSTREAM_PORT=80
      - VIRTUAL_HOST=magento-website.docker
      - VIRTUAL_PORT=80
      - VIRTUAL_PROTO=http
    expose:
      - '80'
    depends_on:
      varnish:
        condition: service_started
  generic:
    hostname: generic.magento-website.docker
    image: 'magento/magento-cloud-docker-php:8.3-cli-1.4.0'
    env_file: ./.docker/config.env
    environment:
      - 'PHP_EXTENSIONS=bcmath bz2 calendar exif gd gettext intl mysqli pcntl pdo_mysql soap sockets sysvmsg sysvsem sysvshm opcache zip xsl sodium redis'
  build:
    hostname: build.magento-website.docker
    image: 'magento/magento-cloud-docker-php:8.3-cli-1.4.0'
    extends: generic
    volumes:
      - '.:/app:rw,delegated'
      - 'quick-forms-vendor:/app/vendor:rw,delegated'
      - 'quick-forms-generated:/app/generated:rw,delegated'
      - '~/.composer/cache:/composer/cache:rw,delegated'
    networks:
      magento-build:
        aliases:
          - build.magento-website.docker
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
      opensearch:
        condition: service_healthy
  deploy:
    hostname: deploy.magento-website.docker
    image: 'magento/magento-cloud-docker-php:8.3-cli-1.4.0'
    extends: generic
    volumes:
      - '.:/app:rw,delegated'
      - 'quick-forms-vendor:/app/vendor:rw,delegated'
      - 'quick-forms-generated:/app/generated:rw,delegated'
      - 'quick-forms-var:/app/var:rw,delegated'
      - 'quick-forms-app-etc:/app/app/etc:rw,delegated'
      - 'quick-forms-pub-media:/app/pub/media:rw,delegated'
      - 'quick-forms-pub-static:/app/pub/static:rw,delegated'
      - '.docker/mnt:/mnt:rw,delegated'
      - '~/.composer/cache:/composer/cache:rw,delegated'
    networks:
      magento:
        aliases:
          - deploy.magento-website.docker
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
      opensearch:
        condition: service_healthy
volumes:
  quick-forms-vendor: {  }
  quick-forms-generated: {  }
  quick-forms-var: {  }
  quick-forms-app-etc: {  }
  quick-forms-pub-media: {  }
  quick-forms-pub-static: {  }
  quick-forms-magento-db: {  }
networks:
  magento:
    driver: bridge
  magento-build:
    driver: bridge
  shared-network:
    external: true

.magento.docker.yml

name: "magento-website"
system:
  mode: 'production'
services:
  php:
    version: '8.3'
    extensions:
      enabled:
        - xsl
        - json
        - redis
  mysql:
    version: '10.4'
    image: 'mariadb'
  redis:
    version: '6.0'
    image: 'redis'
  opensearch:
    version: '2.5'
    image: 'magento/magento-cloud-docker-opensearch'
hooks:
  build: |
    set -e
    php ./vendor/bin/ece-tools run scenario/build/generate.xml
    php ./vendor/bin/ece-tools run scenario/build/transfer.xml
  deploy: 'php ./vendor/bin/ece-tools run scenario/deploy.xml'
  post_deploy: 'php ./vendor/bin/ece-tools run scenario/post-deploy.xml'
mounts:
  var:
    path: 'var'
  app-etc:
    path: 'app/etc'
  pub-media:
    path: 'pub/media'
  pub-static:
    path: 'pub/static'