MailCatcher is an email testing tool that acts as a local SMTP server which accepts incoming email messages that displayed in a web interface. MailCatcher can be useful for testing and debugging purposes, helping developers for inspecting emails that are generated by their application.
This tutorial explains how to install MailCatcher inside a Docker container in the Linux. Commands have been tested on Ubuntu.
Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.
- Host network
Run the following command to create a container for MailCatcher that uses host network:
docker run -d --name=mailcatcher --restart=always --network=host \ dockage/mailcatcher
- User-defined bridge network
User-defined bridge network can be used for listening on different port. By default, MailCatcher service is listening for SMTP connections on port 1025. Web UI is available on port 1080. Both ports can be changed with
docker network create app-net
docker run -d --name=mailcatcher --restart=always --network=app-net \ -p 8080:1025 -p 8081:1080 \ dockage/mailcatcher
To access web UI, open a web browser and go to
<IP_ADDRESS> is the IP address of the system.
To completely remove MailCatcher, remove its container:
docker rm --force mailcatcher
Remove MailCatcher image:
docker rmi dockage/mailcatcher
If a user-defined bridge network was created, you can delete it as follows:
docker network rm app-net
Leave a CommentCancel reply