How do I connect a database to mautic using docker compose?

584 views Asked by At

I am trying to deploy mautic in my docker server (using portainer on OMV) and am having issues building the connection to the mysql database. I am trying to follow the instructions from the docker hub as close as possible https://hub.docker.com/r/mautic/mautic.

Here is my docker compose file:

version: "2"

services:
  database:
    image: powertic/percona-docker
    container_name: database
    environment:
      MYSQL_ROOT_PASSWORD: mypassword
    ports:
      - "3306:3306"
    volumes:
      - database:/var/lib/mysql
    restart: always
    networks:
      - mauticnet
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --sql-mode=""

  mautic:
    container_name: mautic
    image: mautic/mautic:v3
    depends_on:
    - database
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=database
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=mypassword
      - MAUTIC_DB_NAME=mautic3
    restart: always
    networks:
      - mauticnet
    ports:
      - "8880:80"

networks:
  mauticnet:
    driver: bridge

When I try to deploy I get the following error:

Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /makedb.php on line 20



MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
0

There are 0 answers