How to install Mautic with docker on Ubuntu

Published on 2020-03-06· Updated on 2020-03-16


Mautic is one of the popular open-source Marketing automation application which can be used for multiple use cases of marketing paradigm. It ranges from sending bulks emails by uploading an Email list, Scheduling and Creating campaigns, Sending SMS and User journey.

There are many ways to install Mautic on your system, In this tutorial we will see how you can install Mautic with docker on the Linux server - Ubuntu. This might be critical for those who want easy deployment of the Mautic services with ease of Migration since docker does it really well.


  1. Apache
  2. An SMTP service provider like Pepipost
  3. Docker
  4. Docker-compose

Step 1: Check docker installation

$ sudo docker -v

You can install docker using the following command (Skip, in case you have docker already installed):

$ sudo apt-get install docker-ce docker-ce-cli

Enable docker (Necessary in order to boot docker in case of server reboot)

$ sudo systemctl enable docker

Step 2: Check docker-compose installation

$ sudo docker-compose -v

For installation of docker-compose follow these steps (Skip, in case you have docker-compose already installed):

  • Run this command to download the current stable release of Docker Compose:
$ sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • Apply executable permissions to the binary:
$ sudo chmod +x /usr/local/bin/docker-compose

Step 3: Create docker-compose.yml file

The docker compose file will have all of the docker configuration that will be needed for the installation of Mautic and its dependent services such as Mysql.

$ sudo vim docker-compose.yml

Paste the following content in the yml file

version: '2'


    restart: always
    image: percona/percona-server:5.7
    container_name: mauticdb
      - mysql_data:/var/lib/mysql
      - MYSQL_ROOT_PASSWORD=mysecret
      --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
      - mautic-net

    restart: always
    image: mautic/mautic:latest
    container_name: mautic
      - mauticdb:mysql
      - mauticdb
      - 8080:80
      - mautic_data:/var/www/html
      - MAUTIC_DB_HOST=mauticdb
      - MYSQL_PORT_3306_TCP=3306
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=mysecret
      - MAUTIC_DB_NAME=mautic
      - mautic-net

    driver: local
    driver: local
    driver: bridge

This will set the Mysql and Mautic files configuration to these values that you can change according to your requirements.

Step 4: Build and run the docker containers

With the following command the respective Mautic and Mysql images will be installed through docker and it will up all required containers and run it on the specified ports in the docker-compose.yml file. For our case Mysql instance will run on the default Mysql port 3306 and Mautic instance will run on port 8080.

$ sudo docker-compose up -d

you can access this service at http://locahost:8080.

Step 5: Set up reverse proxy

Apache 2:

Follow these steps to setup reverse proxy for Apache2 server:

$ sudo vim /etc/apache2/apache2.conf

Paste these lines

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

Create these directories for virtual hosts

$ sudo mkdir /etc/apache2/sites-enabled/
$ sudo mkdir /etc/apache2/sites-available/

Create a new configuration file name mautic.conf:

$ sudo vim /etc/httpd/sites-available/mautic.conf

Paste these lines

<VirtualHost *:80>
        ServerName localhost
        ProxyPreserveHost On
        ProxyPass        "/" "" retry=1 timeout=600 Keepalive=On
        ProxyPassReverse "/" ""
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Make sure that you have rewrite mod enabled for apache

$ sudo a2ensite mautic.conf
$ sudo a2enmod rewrite

Enable reverse proxy for apache

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod proxy_balancer
$ sudo a2enmod lbmethod_byrequests

Restart Apache server

$ sudo service apache2 restart

Now with this you can access the Mautic instance at http://<your-server-domain>


If you haven’t yet set up Mautic, you will be redirected to the installation panel.

If all the dependencies are matched for the installation of Mautic you will be shown a Ready to install prompt on the screen, Else the dependencies that are not satisfied will be listed on the panel.

If there are any minor bugs that need to be fixed they will be listed in the recommendations section. You can opt for fixing these recommendations.

Step1: Resolving remaining dependencies

After you have fixed the stated dependencies click on [Next Step] button.


Step 2: Set your database credentials

  • Keep the Database Driver to preset MYSQL PDO
  • Enter database name mautic, database username mauticuser and password that you have set. (with docker installation these fields will auto-populate with new the set credentials specified in the docker file)
  • No need to set Backup existing tables Option if this is your first installation
  • Click on next


Click on the Next Step button.

Note:- If you are having a problem with the blank Database Driver dropdown please make sure that you have all PHP dependencies installed you might haven't installed mysqlmd php dependency.

Step 3: Set Admin user settings

Enter the Admin credentials, these credentials will be used when logging in the Mautic user panel.

The email address you enter will be used for password resets.

Click on the Next Step button.

Before you proceed to the next step you will need our Pepipost SMTP server credentials.

Step 4: Get your Pepipost SMTP credentials

  • Log in with your user credentials on Pepipost application
  • Open SMTP integration panel using this link
  • You will find your SMTP credentials in SMTP Relay tab

Please check the screenshot provided below for reference:


You will use these credentials to set up our SMTP configuration in the next step

Step 5: Set  SMTP configuration settings

Now back at the Mautic installation screen

In [Who should the email be sent as?] section there are two parameters

  1. Your from-name that would be seen on the send email.
  2. Your from-email-id, for example, [email protected]. The domain name should be a valid and verified domain in order to send emails from the Pepipost mail server.

in [How should email be spooled and delivered?] section you will be setting the following options.

In Email handling, there are two options.

  1. First is Send Immediately: This is recommended if your email list is not too large else it will result in a slowdown.
  2. Second is Queue: This option means that the mail list will be kept in a message pool and are in a wait state until it is executed in a batch by send email cron.

Mailer transport: Select [Other SMTP Server]


Port: 25 [or you can set the port to 587 if 25 is blocked at your sever]

Encryption: TLS

Authentication mode: Login

Username: Your_Pepipost_username

Password: Your_Pepipost_password

Click on Next step

After this, you will be redirected to the login panel. Log in with your credentials and with this you will move on to the next step

This is how your dashboard will look


Sending your first test mail

Step 1: Add new contacts

There are two steps for creating new contacts

1. Single contact creation

  • Click on contacts in the navbar
  • Click on New
  • You will be able to view a detailed form in which you can add user credentials, for testing purposes you can add email and username.
  • Click on [Apply]
  • Click [Save & Close]
  • In your contact panel, you will be able to see the newly created contact


2. Bulk Upload email list

  • Create a new CSV file with a list of emails that you want to send your emails to. Refer below image for CSV file reference.


  • Click on contacts in the navbar
  • Click on the dropdown arrow next to prev button
  • Click on import


  • File upload panel will open
  • Click on choose file
  • Select the CSV files of email list and click on upload
  • You can change the limit option when you are uploading a large CSV file, this parameter decides the number of email batches that Mautic will start importing at a time.


  • After this, you will be redirected to the Import panel, where you can select multiple options for the upload.
  • There are two sections in this panel the first one is optional which you can set to customize your import 
  • In the second section, the values will be visible above the dropdown select the appropriate dropdown value according to the value above it, for example, Clients First Name should be assigned to First name dropdown and email id to email as shown in the screenshot below.


  • Now there are two options to import, First is Import in the browser(For small email lists could be in hundreds or a thousand) the import needs the browser window to stay open. It is faster and you will be able to see the progress through a progress bar but is not recommended for a very large email list.
  • The second is import in the background which is recommended for a large import list which could be in the ten thousand or in millions but doesn’t need the browser to be kept open.
  • After the import, the success message would be displayed and you can view the imported contacts.

Step 2: Create a new segment

  • Click on Segments in the navbar
  • There would be no segments created In the segments panel so click on New button
  • Enter segment name and alias (you can leave this empty, it will auto-generate if it is set to blank)


  • Click on the Filters tab
  • Now you will be filtering the email list on email id, So in the dropdown select the email 


  • Set the email filtering conditions based on which particular emails will be grabbed from your email list to your campaign.
  • You can use the filtering in a really flexible way to filter out the emails, for more information on segments please refer this link
  • For this tutorial, you will select [is not empty] option in order to select all emails in the list by setting an email filter to not empty.


  • Click on Apply -> Save & Close
  • Depending upon the Cron set up your segment list will be populated

Step3: Create a new campaign

  • Click on campaigns section in the navbar
  • Click on the New button
  • Enter campaign name and description


  • Click on [Launch campaign builder]
  • In contact source select  [Contact Segments]
  • A popup will open named Contact Source in it select the segment you want to apply and click on add


  • Click on [Apply]->[Save & Close]
  • After this, you will see a square block with the name of the segment on it
  • Click on the grey semicircle and you will be able to see some options as shown in the image


  • Click on the select button inside the Action section and select Send Email from the dropdown which will appear once you click on select.
  • A popup will open named Send Email. 


  • Set the Email name
  • Inside Email to send click on the Create new dropdown
  • A popup will open with a number of email templates that you can use to send the email.
  • For now, you can select the Blank template option.
  • Enter some basic credentials like Subject, Internal name.


  • Click on the Advanced tab
  • Enter From-name 
  • Enter From-address as your valid from address is with a valid domain name
  • Enter Reply-to address


  • Click on Builder button to open builder, a new window will open 
  • Create your email body as per your requirements


  • Click on [Apply] -> [Save & Close]
  • Set email type according to your needs


  • Click on add. The panel will close and you will be able to see the email flow in a relational diagram.


  • Click on [Apply] -> [Close Builder]
  • In the Edit Campaign panel set published to Yes
  • Click on [Apply] -> [Save & Close]

This will open the Campaign panel in which all the campaign status is represented in a graphical format in which you can track the emails that are being sent.

With this, your campaign is ready to send emails from your imported segment.

After some time as the Cron runs, you will be able to see the emails being populated in the dashboard.

You can check the progress of your campaign in the campaign panel.



By following the above-mentioned steps you are now ready to send emails through the Mautic. You are now able to upload an email list, create an email body, filter the email leads with segments and send emails using the Pepipost SMTP server on docker platform.

Grade My Email
Check your spam now?

Netcorecloud's toolkit is the solution to all your email problems.

2.1k Likes 20 comments

Hitesh Pandey💻

Full Stack Developer, Pepipost

🥑 Developer Evangelist | 🥇Email Geek

You can also explore

Netcore connects & unifies your data across all sources, connects to your marketing channels and provides you with control over AI Powered automation and personalization.

Join over 30,000
Fellow Marketers

Get expert marketing tips straight to your inbox and become a better marketer. Subscribe to our Blog.
Request Demo
Get Started Now