Hi all,
I installed on Oracle Linux 8.3 Docker CE Engine
After I created a volume with this command:
docker volume create docker-maildir
I installed the container MAILHOG and force to use my volume with this command:
docker run -d -p 25:1025 -p 2080:8025 -v docker-maildir:/maildir --name mailhog --restart unless-stopped mailhog/mailhog
but if I restart the container I lost the inbox emails.
I tried to access to the container with the command:
docker exec -it mailhog /bin/sh
But I don’t see any emails in the folders.
How can set -storage?
Configuring MailHog
===================
You can configure MailHog using command line options or environment variables:
| Environment | Command line | Default | Description
| ------------------- | --------------- | --------------- | -----------
| MH_CORS_ORIGIN | -cors-origin | | If set, a Access-Control-Allow-Origin header is returned for API endpoints
| MH_HOSTNAME | -hostname | mailhog.example | Hostname to use for EHLO/HELO and message IDs
| MH_API_BIND_ADDR | -api-bind-addr | 0.0.0.0:8025 | Interface and port for HTTP API server to bind to
| MH_UI_BIND_ADDR | -ui-bind-addr | 0.0.0.0:8025 | Interface and port for HTTP UI server to bind to
| MH_MAILDIR_PATH | -maildir-path | | Maildir path (for maildir storage backend)
| MH_MONGO_COLLECTION | -mongo-coll | messages | MongoDB collection name for message storage
| MH_MONGO_DB | -mongo-db | mailhog | MongoDB database name for message storage
| MH_MONGO_URI | -mongo-uri | 127.0.0.1:27017 | MongoDB host and port
| MH_SMTP_BIND_ADDR | -smtp-bind-addr | 0.0.0.0:1025 | Interface and port for SMTP server to bind to
| MH_STORAGE | -storage | memory | Set message storage: memory / mongodb / maildir
| MH_OUTGOING_SMTP | -outgoing-smtp | | JSON file defining outgoing SMTP servers
| MH_UI_WEB_PATH | -ui-web-path | | WebPath under which the ui is served (without leading or trailing slahes), e.g. 'mailhog'
| MH_AUTH_FILE | -auth-file | | A username:bcryptpw mapping file
This file has been truncated. show original
terpz
(Martin Terp)
January 27, 2021, 1:54pm
2
I think this should maybe be asked on the mailhog github, since its not directly docker related.
but, reading what you supplied, i see that:
| Environment | Command line | Default | Description
MH_STORAGE | -storage | memory
so maybe change that variable to “maildir”, else it seems like it will save to memory
Hi tepz,
thank you for your reply.
I solved with this command:
docker run -d -p 25:1025 -p 2080:8025 -v mailhog-maildir:/home/mailhog/maildir -v mailhog-smtpconf:/smtp_conf -e MH_STORAGE=maildir -e MH_MAILDIR_PATH=maildir -e MH_OUTGOING_SMTP=/smtp_conf/smtp.json --restart unless-stopped --name mailhog mailhog/mailhog
But I have to set the permission for the volume as 777 otherwise from mailhog I can’t write emails to the volume mounted.
Marco
terpz
(Martin Terp)
January 27, 2021, 2:03pm
4
For the volume?
I would set the path to /maildir, so it isnt in the home/mailhog path, but again, its just my 2 cents
Hi Martin,
thank you so much for your reply and your time.
I started few time ago to studi docker, and I’m not very expert.
I mapped correctly the folder, /mail dir on the container is in /home/mailhog/maildir and it is mapped correctly with my volume mailhog-maildir.
Now, is I set the permission on _data folder for mailhog-maildir as 777 from container I can write on it, also I can’t.
Thanks
Marco