docker-isync
Dockerized isync.
isync syncs an IMAP mailbox to a Maildir (emails as individual files), in contrast to imap-backup which syncs an IMAP Mailbox as .mbox backup files. Additionally, isync can also sync two IMAP mailboxes.
| Tag | Dockerfile Build Context |
|---|---|
:1.5.0, :latest | View |
:1.5.0-pingme | View |
:1.5.0-restic | View |
:1.5.0-restic-pingme | View |
:1.4.4 | View |
:1.4.4-pingme | View |
:1.4.4-restic | View |
:1.4.4-restic-pingme | View |
restic: Includes restic. Useful for cron-based backups.pingme: Includes pingme. Useful for sending notifications to well-known services.
pingme variants have fewer architectures. More architectures will be added in future.All images contain:
curl and jq, which are useful for sending notifications if neededrsync which is useful for incrementally copying mails or backupsNote:
isyncthe project name,mbsyncis the tool.
The mbsync config file used in this image is /mbsyncrc. The volume used to store local Maildir is /mail. The main sync script is /sync.
Here are three common sync cases:
For cron-based examples, see below.
For a simple demo of the three sync cases, see this docker-compose demo.
If needed, see official docs.
This syncs [email protected] to a local Maildir /mail. Sync state is kept in each folder in /mail.
Create config file mbsyncrc:
$ cat mbsyncrc
IMAPStore example-remote
Host imap.example.com
User [email protected]
Pass test
AuthMechs LOGIN
SSLType IMAPS
# Limit the number of simultaneous IMAP commands
PipelineDepth 30
MaildirStore example-local
SubFolders Verbatim
# The trailing '/' is important for Path
Path /mail/
Inbox /mail/INBOX
Channel example
Far :example-remote:
Near :example-local:
Patterns *
Create Near
Expunge Near
SyncState *
Sync Pull
Sync:
docker run --rm -it -v $(pwd)/mbsyncrc:/mbsyncrc:ro -v mail:/mail theohbrothers/docker-isync:latest
This syncs a local Maildir /mail to [email protected]. Sync state is kept in each folder in /mail.
Create config file mbsyncrc:
$ cat mbsyncrc
IMAPStore example-remote-2
Host imap.example.com
User [email protected]
Pass test
AuthMechs LOGIN
SSLType IMAPS
# Limit the number of simultaneous IMAP commands
PipelineDepth 30
MaildirStore example-local
SubFolders Verbatim
# The trailing '/' is important for Path
Path /mail/
Inbox /mail/INBOX
Channel example
Far :example-remote-2:
Near :example-local:
Patterns *
Create Far
Expunge Far
SyncState *
Sync Push
Sync:
docker run --rm -it -v $(pwd)/mbsyncrc:/mbsyncrc:ro -v mail:/mail theohbrothers/docker-isync:latest
This syncs [email protected] to [email protected]. Sync state is kept in the /mbsync volume. The /mail volume is not used since there's no local Maildir.
Create config file mbsyncrc:
$ cat mbsyncrc
IMAPStore example-remote
Host imap.example.com
User [email protected]
Pass test
AuthMechs LOGIN
SSLType IMAPS
# Limit the number of simultaneous IMAP commands
PipelineDepth 30
IMAPStore example-remote-3
Host imap.example.com
User [email protected]
Pass test
AuthMechs LOGIN
SSLType IMAPS
# Limit the number of simultaneous IMAP commands
PipelineDepth 30
Channel example
Far :example-remote:
Near :example-remote-3:
Patterns *
Create Near
Expunge Near
SyncState /mbsync/
Sync Pull
Sync:
docker run --rm -it -v $(pwd)/mbsyncrc:/mbsyncrc:ro -v mbsync:/mbsync theohbrothers/docker-isync:latest
For cron-based sync and backup with notifications, see docker-compose example(s):
Instead of typing secrets as plain text in /mbsyncrc config file for the User and Pass options of IMAPStore (or IMAPAccount), use UserCmd or PassCmd which accepts a shell command. This helps to separate configuration from secrets.
For example, if secrets are bind mounted as files in /run/secrets/user and /run/secrets/pass, use the following:
UserCmd "cat /run/secrets/user"
PassCmd "cat /run/secrets/pass"
If secrets are in environment variables IMAP_USER and IMAP_PASS, use the following:
UserCmd "echo $IMAP_USER"
PassCmd "echo $IMAP_PASS"
To view command line usage:
docker run --rm -it theohbrothers/docker-isync:latest --help
outlook.com IMAP servers, it might be necessary to use PipelineDepth 1 in the config file to limit the number of simultaneous IMAP commands. See here.Requires Windows powershell or pwsh.
# Install Generate-DockerImageVariants module: https://github.com/theohbrothers/Generate-DockerImageVariants
Install-Module -Name Generate-DockerImageVariants -Repository PSGallery -Scope CurrentUser -Force -Verbose
# Edit ./generate templates
# Generate the variants
Generate-DockerImageVariants .
versions.json contains a list of Semver versions, one per line.
To update versions in versions.json:
./Update-Versions.ps1
To update versions in versions.json, and open a PR for each changed version, and merge successful PRs one after another (to prevent merge conflicts), and finally create a tagged release and close milestone:
$env:GITHUB_TOKEN = 'xxx'
./Update-Versions.ps1 -PR -AutoMergeQueue -AutoRelease
To perform a dry run, use -WhatIf.
Content type
Image
Digest
sha256:c35b7e315…
Size
22.2 MB
Last updated
8 months ago
docker pull theohbrothers/docker-isync:20251121.0.0-a03cdc0-1.5.0-restic-pingme