Adding composer for symphony amazon-mailer inside docker

Your software
My Mautic version is: official prebuilt v5-apache (docker)

Your problem
My problem is: I want to install composer for amazon-mailer, however, when I try to install inside the mautic_web container, I get the following error:

I’m sure adding composer and subsequently amazon-mailer this way to incorrect since the container is ephemeral in nature.

Is there a way to install composer inside mautic container and use amazon-mailer DSN?

Are you using docker-compose.yml? If so it’ll make it a bit difficult to troubleshoot without seeing that file. If you only have the Apache image, it doesn’t include PHP, which could be the reason those dependencies aren’t installing.

There is also a docker image available:
https://hub.docker.com/r/mautic/mautic

This will install all the necessary images and configure everything you need.

Here’s a simple docker-compose.yml modified from docker-mautic/examples/basic at mautic5 · mautic/docker-mautic · GitHub

version: '3'

x-mautic-volumes:
  &mautic-volumes
  - ./mautic/config:/var/www/html/config:z
  - ./mautic/logs:/var/www/html/var/logs:z
  - ./mautic/media/files:/var/www/html/docroot/media/files:z
  - ./mautic/media/images:/var/www/html/docroot/media/images:z
  - ./cron:/opt/mautic/cron:z

services:
  db:
    image: lscr.io/linuxserver/mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=redacted
      - MYSQL_DATABASE=mautic_db
      - MYSQL_USER=mautic_db_user
      - MYSQL_PASSWORD=mautic_db_pwd123
    volumes: 
      - mysql-data:/var/lib/mysql
    healthcheck:
      test: mysqladmin --user=mautic_db_user --password=mautic_db_pwd ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10

  mautic_web:
    image: mautic/mautic:5-apache
    links:
      - db:mysql
    ports:
      - 8001:80
    volumes: *mautic-volumes

    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=false
      - DOCKER_MAUTIC_RUN_MIGRATIONS=false
      - MAUTIC_DB_HOST=db
      - MAUTIC_DB_PORT=3306
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=mautic_db_pwd123

    healthcheck:
      test: curl http://localhost
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 100
    depends_on:
      db:
        condition: service_healthy

  mautic_cron:
    image: mautic/mautic:5-apache
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_cron
      - MAUTIC_DB_HOST=db
      - MAUTIC_DB_PORT=3306
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=mautic_db_pwd123
    depends_on:
      mautic_web:
        condition: service_healthy

  mautic_worker:
    image: mautic/mautic:5-apache
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
      - MAUTIC_DB_HOST=db
      - MAUTIC_DB_PORT=3306
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=mautic_db_pwd123

    depends_on:
      mautic_web:
        condition: service_healthy
volumes:
  mysql-data:

I’m using pre-built mautic/mautic:5-apache images hosted at docker hub.

If you only have the Apache image, it doesn’t include PHP, which could be the reason those dependencies aren’t installing.

Will mautic/mautic:5-fpm work?

Per their documentation, their apache image includes php:apache. If you are only using their Docker Compose file, you are just building the images. The Dockerfile is what configures those images. You can see in the Mautic Dockerfile that it adds and configures PHP extensions required to use Mautic.

If you pull from Docker Hub it should just work, at least it does for us. Just backup what you have so far just in case.

docker pull mautic/mautic

I just saw this mentioned on the github

Currently this image has no easy way to extend Mautic (e.g. adding extra composer dependencies or installing extra plugins or themes).

This is an ongoing effort we hope to support in an upcoming 5.x release.
For now, please build your own images based on the official ones to add the needed dependencies, plugins and themes.

I guess, issue closed. I might build my own custom image.