Since the official MailHog Docker image don't natively support M1 I needed a custom build for my setup.
Supported architectures: linux/arm64
, linux/amd64
, linux/amd64/v2
, linux/ppc64le
& linux/s390x
https://hub.docker.com/r/openharbor/mailhog
Pull golang:1.18-apline then install MailHog:1.0.1 from source. Finaly it fetch the latest alpine image and copy compiled MailHog to it to get the lighest image possible. It also fix a bug with boot2docker (github issues #581)
If you want to build your own image and/or version, you can download this Dockerfile and modify it for your needs. You then have to type the following command:
$ docker build -t openharbor/mailhog:<version> -t openharbor/mailhog:latest --platform linux/arm64,linux/amd64,linux/amd64/v2,linux/ppc64le,linux/s390x .
You should replace openharbor with your docker username and mailhog with your image name. You can also change the platform list depending on what's available on your system. To know what's the platform you can build for from your machine type:
$ docker buildx ls
To publish your own version to docker hub, you'll need to type the following commands:
$ docker push openharbor/mailhog:<version>
$ docker push openharbor/mailhog:latest
Where you also changes openharbor with your username and mailhog with your new image name.
To use a custom image in your docker-compose.yml it's like using any other image, all you have to supply is the username and project published to docker hub.
version: "3"
services:
mailhog:
image: openharbor/mailhog
ports:
- "1025:1025" # smtp server
- "8025:8025" # web ui
Follow the docker run documentation with the custom image specified:
$ docker run --rm --name my-container-name openharbor/mailhog