Offlineimap dockerfile.
Go to file
Maximilian Kratz ae049aa32b Adds a LICENSE 2024-03-30 07:46:50 +01:00
.github/workflows Updates all GitHub-based Actions to their latest versions 2023-12-20 09:15:21 +01:00
Dockerfile Updates base OS to Ubuntu 22.04 2022-07-03 15:35:21 +02:00
LICENSE Adds a LICENSE 2024-03-30 07:46:50 +01:00 Fixes a broken URL 2023-01-29 12:58:33 +01:00 Adds build script + adapts CI configuration 2022-01-22 15:35:26 +01:00


Build Docker images

Unofficial OfflineIMAP Dockerfile for backing up all folders of an imap server.


After installing docker, just run the following command:

docker pull maxkratz/offlineimap:latest

Environment variables

You can use the following environment variables for customization of this container:

MAILLOG # If set to true, container will create a log instead of using console output

Mount volumes or bind folders

One may mount a folder of the host to /mnt/mail within the container to enable persistent backups of imap servers.

  • /mnt/mail may be used as backup target.
  • /mnt/config will be used as config. Be sure to place a file named offlineimap.conf with a valid configuration in here.
  • /mnt/secret may be used as folder to get secrets from. You can e.g. place password files in this folder and use them in your config file.
  • /mnt/log will be used as log target (if environment variable is set).

Full example command

docker run -it -v ~/email-backups/offlineimap-config:/mnt/config -v ~/email-backups/offlineimap-secret:/mnt/secret -v ~/email-backups/offlineimap-mail:/mnt/mail -v ~/email-backups/offlineimap-log:/mnt/log -e MAILLOG=TRUE maxkratz/offlineimap:latest


accounts = personal-mail

[Account personal-mail]
localrepository = local-personal-mail
remoterepository = remote-personal-mail

[Repository local-personal-mail]
type = Maildir
localfolders = /mnt/mail

[Repository remote-personal-mail]
type = IMAP
remotehost =
remoteuser = user123
remotepassfile = /mnt/secret/password.conf
sslcacertfile = /etc/ssl/certs/ca-certificates.crt



Please notice that this container provides validated CAs in folder shown above.


The Dockerfile can be found at:

What gets installed in this container?

The following packages are installed within this docker container:

  • Some utility packages like locales, bash-completion, ca-certificates etc.
  • OfflineIMAP (thats the whole point ...)