Portainer Templates logo

Portainer Templates

ProtonMail Bridge ProtonMail Bridge

Container

EmailProductivityToolsOther

This is an unofficial Docker container of the ProtonMail Bridge. Some of the scripts are based on Hendrik Meyer's work.

Image details

Pulls: 1.9M
Architecture: amd64, arm64, arm/v7, riscv64
Image size: 79 MB
Latest: 3.19.0-build
User: shenxn
Created: Apr 15, 2020
Updated: 1 years ago
Status: active

Configuration

Type
Container
Platform
linux
Image
shenxn/protonmail-bridge:latest
Ports
143/tcp25/tcp
Volumes
/root : /portainer/Files/AppData/ProtonMail-Bridge
Restart
unless-stopped

Template by mikestraney

Notes

Please refer to the documentation here to set this up.

Standalone Install

Select an install method, to see config/commands for deploying ProtonMail Bridge

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select ProtonMail Bridge, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo

More install options in our documentation.

ProtonMail IMAP/SMTP Bridge Docker Container

version badge image size badge docker pulls badge deb badge build badge
This is an unofficial Docker container of the ProtonMail Bridge. Some of the scripts are based on Hendrik Meyer's work.
Docker Hub: https://hub.docker.com/r/shenxn/protonmail-bridge
GitHub: https://github.com/shenxn/protonmail-bridge-docker

ARMv7 Builds

Currently there is a problem building the new parser targeting 32-bit architectures (i.e. arm/v7). The latest working build is 1.4.5-build. Therefore, if you are using an arm/v7 device like Raspberry Pi, do not upgrade to newer version. More information about the problem can be found here. If you have any idea on how to fix this, a PR is welcome.

ARM Support

We now support ARM devices (arm64 and arm/v7)! Use the images tagged with build. See next section for details.

Tags

There are two types of images. - deb: Images based on the official .deb release. It only supports the amd64 architecture. - build: Images based on the source code. It supports amd64, arm64, and arm/v7. Supporting to more architectures is possible. PRs are welcome.
tag | description -- | -- latest | latest deb image [version] | deb images build | latest build image [version]-build | build images

Initialization

To initialize and add account to the bridge, run the following command.
docker run --rm -it -v protonmail:/root shenxn/protonmail-bridge init

Wait for the bridge to startup, use login command and follow the instructions to add your account into the bridge. Then use info to see the configuration information (username and password). After that, use exit to exit the bridge. You may need CTRL+C to exit the docker entirely.

Run

To run the container, use the following command.
docker run -d --name=protonmail-bridge -v protonmail:/root -p 1025:25/tcp -p 1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge

Security

Please be aware that running the command above will expose your bridge to the network. Remember to use firewall if you are going to run this in an untrusted network or on a machine that has public IP address. You can also use the following command to publish the port to only localhost, which is the same behavior as the official bridge package.
docker run -d --name=protonmail-bridge -v protonmail:/root -p 127.0.0.1:1025:25/tcp -p 127.0.0.1:1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge

Besides, you can publish only port 25 (SMTP) if you don't need to receive any email (e.g. as a email notification service).

Kubernetes

If you want to run this image in a Kubernetes environment, #6 can be helpful.

Compatibility

The bridge currently only supports some of the email clients. More details can be found on the official website. I've tested this on a Synology DiskStation and it runs well. However, you may need ssh onto it to run the interactive docker command to add your account. The main reason of using this instead of environment variables is that it seems to be the best way to support two-factor authentication.

Bridge CLI Guide

The initialization step exposes the bridge CLI so you can do things like switch between combined and split mode, change proxy, etc. The official guide gives more information on to use the CLI.

Build

For anyone who want to build this container on your own (for development or security concerns), here is the guide to do so. First, you need to cd into the directory (deb or build, depending on which type of image you want). Then just run the docker build command
docker build .

That's it. The Dockerfile and bash scripts handle all the downloading, building, and packing. You can also add tags, push to your favorite docker registry, or use buildx to build multi architecture images.

Serve ProtonMail Bridge on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.

Proxying protonmail-bridge.example.com to http://protonmail-bridge:143

Add this to your Caddyfile

protonmail-bridge.example.com {
	reverse_proxy http://protonmail-bridge:143
}

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs protonmail-bridge
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Published on a random port

This template exposes 143/tcp without setting a host port, so Docker picks a random free one on every deploy.

  • Find it in the Ports column of Portainer's container list, or with docker port protonmail-bridge

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Fix the ownership: sudo chown -R 1000:1000 /portainer/Files/AppData/ProtonMail-Bridge

Image won't pull

Test the pull directly on the host: docker pull shenxn/protonmail-bridge:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64, arm/v7, riscv64
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect protonmail-bridge --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A single container

ProtonMail Bridge runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.

The app image

An image is the app packed up ready to go, everything ProtonMail Bridge needs bundled into one download. This template pulls shenxn/protonmail-bridge:latest, which Docker fetches once (about 79 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. ProtonMail Bridge's comes from Docker Hub, published by shenxn.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is 3.19.0-build. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, arm64, arm/v7, riscv64, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.

Ports

A port is the door the app answers on. Here the app exposes a port but leaves the host side blank, so Docker picks a free one for you. It opens:

  • 143, published on a random host port
  • 25, published on a random host port

Volumes

A volume is where ProtonMail Bridge keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:

  • /root from /portainer/Files/AppData/ProtonMail-Bridge on the host

Restart policy

The restart policy here is unless-stopped, so Docker restarts ProtonMail Bridge after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).

Networking

Nothing custom is set, so ProtonMail Bridge sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container protonmail-bridge. That's what you'll spot in the containers list and use in commands like docker logs protonmail-bridge.

Platform

The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set ProtonMail Bridge up. Add the template list to Portainer once, then deploying ProtonMail Bridge is a click rather than a wall of config.