The advantage of docker, as I see it for home labs, is keeping things tidy, ensuring compatibility, and easy to manage/backup setup configs, app configs, and app data. It is all very predictable and manageable. I can move my docker compose and data from one host to another in literal seconds. I can, likewise, spin up and down test environments in seconds too. Obviously the whole scaling thing that people love containers for is pointless in a homelab, but many of the things that make it scalable also make it easy to manage.
M365 is doing away with all legacy authentication, do not be surprised if IMAP is completely unusable in the next 12 months. If you simply want to keep a copy of everything, a store and forward SMTP proxy would probably be the solution, so all email going to your domain would hit that first, then send off to M365.