This sounds like what I want. Did you make it work or are you still working on your PhD dissertation to qualify for email server setup training like me? 😕
allows my mail clients to connect via IMAP to view and search emails
dovecot will be able to handle this part. This is what I use as a mail archive (once a year, archive all mail from the previous year from various mailboxes to my self-hosted dovecot instance). I wrote this ansible role for it.
downloads new emails via IMAP
As others recommended, imapsync should be able to handle that part.
downloads new emails via IMAP
These tools are simple enough to install and manage (one package, one config file), Docker is not needed. If you really need it to fit into your docker-based setup, build and maintain your own images.
I can’t give direct experience here, but this is exactly the use case I’ve been meaning to spin up mailpiler for: https://www.mailpiler.org/. One of these days that will rise to the top of the priority list.
I use dovecot for this. And thunderbird to actually move/archive the emails. I use caddy for many of my services, so I have pointed dovecot to caddys certificates (for "my.domain"), since it manages certificates through let's encrypt. I had a plan to install postfix for sending internal emails from my self-hosted services, but it seemed like a bit of configuration and I got busy with other stuff
I made an excerpt from my docker-compose.yml, but you probably have to figure out some things on your own