Getting up and running with Mautic on your Mac with Docker

Getting up and running with Mautic on your Mac with Docker

When I started to try out the Mautic community version on my local instance, it was a bit of a hassle and not very straightforward, for I was new to Mautic, and I am not very familiar with Docker as well.

Some of the issues I stumbled into include -

  1. PHP docker image is very bare bone. Doesn’t come loaded with even the most common of drivers like MySQL. Causing the installation page to not show “MYSQL” as an option. (Mautic issue link)
  2. A regression in Mautic currently doesn’t show the right message on screen for any database connectivity problems during installation. (Mautic issue link). This only made the earlier #1 issue not very obvious
  3. Connecting from the PHP container to MySQL was not getting through either via or via localhost (Mautic issue link)
  4. Mautic doesn’t insist on enabling mod_rewrite during installation. But fails on first login.
  5. Mautic requires Composer 1 and not the latest version 2
  6. Enabling PHP extension like sendmail on docker containers is not straightforward and requires use of docker-php-ext-install script

All of these meant getting Mautic with PHP+Apache+MySQL up and running on Docker wasn’t as simple of a “Hello World” process as I thought it would be.

Sharing below the dockerfile and dockercompose.yml that worked for me addressing the above challenges, along with step-by-step instructions for using them.


  1. Install Docker for Mac -
  2. Download Mautic community edition from
  3. In the root of Mautic codebase, copy the docker-compose.yml -
    (this can be in a separate folder as well, you just need to update the addresses in lines 16 and 30 accordingly if you are using relative paths)
  4. Also in the same location copy the Dockerfile -
    This needs to be in the same folder as your docker-compose.yml - else update the path in the build: . command in your docker-compose.yml file.
  5. As you might have seen the Dockerfile expects a php.ini file in the same folder. The contents of that php.ini can be as below

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
display_errors = On
display_startup_errors = On
log_errors = On
error_log = /dev/stderr
sendmail_path = "env -i /usr/sbin/sendmail -t -i"

  1. Once both files are in place - you can run the below command from root of your mautic folder (where you also have the docker-compose.yml file)
    docker-compose up --build
  2. Furthermore, you should be able to access Mautic from localhost/ on your browser.
  3. Your DB connection details would look like the below, and you should be able to proceed with installation of Mautic by pointing your browser to localhost.
    Note the use of host.docker.internal instead of localhost or in DB connection

'db_driver' => 'pdo_mysql',
'db_host' => 'host.docker.internal',
'db_table_prefix' => null,
'db_port' => '3306',
'db_name' => 'mauticcomm',
'db_user' => 'root',
'db_password' => 'example',

Hello @tanaysai,

May I ask, as a non-techie / non-programmer who would like to launch Mautic for the first time … Docker seems like a nice way to compartmentalise different apps, potentially on the same VPS instance? Does this allow one to maintain a copy on a local Mac, for example, and upgrade things, and then if all goes well copy it over to the cloud VPS?

I’m trying to decide whether to install Mautic normally in the VPS cloud instance (which most people here are probably familiar with (so if I need support later, etc, it’d be straight forward) – as opposed to compartmentalising with docker (or something else?) … For instance, I’m also thinking to install iredmail as well so I don’t need to use Amazon SES or similar …

Would Docker be the way to go? Potentially hosting a Wordpress site or two in the same VPS instance as well – separated with a Docker container? Or does it overly complicate things for a non programmer like myself, and must I just do things normally?

Thank you!

Hello @Paul

For a non programmer, Docker is overkill. Plus it is a little bit of a learning curve.

That being said I use docker on my local development machine so that I can have an almost replica of the application as it would be on a live server. This way my local tests if they pass should have no reason to take the application down when it goes to live.

The company I work for created their own docker image (the file that contains all the information for the containers) themselves so it is very bespoke to their infrastructure.

I am by no means an expert with Mautic. I am still working it out

Thank you. I have already launched Mautic in it’s own environment without Docker … however, going forward, I’d love to have multiple mautic instances (for a few different websites) in one self-hosted environment thus saving on costs for maintaining separate ones…

… but alas, I’m not a programmer and would need some sort of guide – as some helpful individuals have already made for installing self-hosted Mautic instances (which allowed me to get up and running with Mautic thus far)… perhaps someone would eventually help the community and make this kind of guide available at some point which would incorporate using Docker for Mautic instances…