Install MailDev Inside Docker Container in Linux

Install MailDev Inside Docker Container in Linux

MailDev is an email testing tool that designed to make it easier for developers to test email sending and receiving functionality by their application. MailDev acts as a local SMTP server which accepts incoming email messages which can be viewed in a web-based interface.

This tutorial explains how to install MailDev inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install MailDev

  • Host network

Run the following command to create a container for MailDev that uses host network:

docker run -d --name=maildev --restart=always --network=host \
    maildev/maildev
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, MailDev service is listening for SMTP connections on port 1025. Web UI is available on port 1080. Both ports can be changed with -p option.

docker network create app-net
docker run -d --name=maildev --restart=always --network=app-net \
    -p 8080:1025 -p 8081:1080 \
    maildev/maildev

Testing MailDev

To access web UI, open a web browser and go to http://<IP_ADDRESS>:1080, where <IP_ADDRESS> is the IP address of the system.

MailDev Inside Docker Container in Linux

Uninstall MailDev

To completely remove MailDev, remove its container:

docker rm --force maildev

Remove MailDev image:

docker rmi maildev/maildev

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.