Mailgun for emails in docker

| Comments

Usually, even a small web application should send some emails: errors, registration, restore password, invitations, etc.

There are 3 solutions:

  • use an existing account, like gmail: the main problem - you don’t know how many emails you can send before being marked as spam
  • use own mail server: need to install, configure and support
  • use email service, like sendgrid, mailgun: easy to configure, provide statistics and logs, can use default http port.

For some my small projects i choosed mailgun, it provides 10000 emails in month for free, for my needs it’s more than enough and after that it’s also not expensive. For django there is a email backend django-mailgun and it takes two minutes to switch to it.

Docker clean commands

| Comments

When you start to use Docker, at some point there will be a question - where is all my space. Most of it is occupied by containers, images and dangling volumes.

An easy way to clean is to use Docker garbage collection by Spotify and docker volume rm commands. I have an alias for this.

alias docker-gc='docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc -e GRACE_PERIOD_SECONDS=172800 spotify/docker-gc && docker volume rm $(docker volume ls -qf dangling=true)'

On mac sometimes it’s easier to remove all, for this you need to remove Docker.qcow2 in the ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux folder. You can find this path in the Docker -> Preferences -> Advanced dialog.

« 2/2