Hi Thomas,
> On 02/01/2022 17:20 Thomas Bellebaum <thomas at bellebaum.eu> wrote:
>
>
> Hello there and happy new year,
>
> I have a question/request regarding the Docker Image hosted at
https://hub.docker.com/r/dovecot/dovecot.
> The Dockerfile itself declares two volumes:
>
> - `/etc/dovecot` for configuration data
> - `/srv/mail` for mail storage
>
> It seems inconvenient in some cases to have the image create these volumes,
especially in case of the former.
>
> Consider a minimal Dockerfile like the following:
>
> ```
> FROM dovecot/dovecot:latest
> COPY dovecot.conf /etc/dovecot/dovecot.conf
> ```
>
> This creates a new image building on top of the official one,
> which has statically configured configuration, and thus does not need to
save its config in a volume.
> Yet currently, since the base image exports volumes, a config volume is
created.
>
Why is it undesirable to have a config volume in docker? What's the impact?
> A user might also choose to save mail in a different directory or even in a
remote SQL database, rendering the second volume unnecessary.
>
This is not how docker works. You can use whatever directory outside docker to
persist the mail data.
Also, you can't store mail without any local persistence volume with
dovecot, so this point is rather without merit.
There is no way to store mails in SQL with dovecot.
> I would like to know a bit about the reasons for declaring the volumes,
> and suggest removing the line, should this be an option.
>
> Some impact considerations:
>
> - Removing the volumes for future image versions will not impact existing
deployments building on tags other than `latest`.
> - As the default (example) configuration is not very useful for
non-test-setups, most people have probably assigned the config volume
explicitly, e.g. using docker's `-v` option. These people will also not be
affected.
> - The description explicitly states to mount `/srv/mail/`, but some people
might rely on the the automatic volume creation nonetheless.
> - Some obscure proprietary scripts may rely on the current behavior.
>
> In any case, if the volumes are no longer declared, the image description
should mention that the mail storage location (the default being `/var/mail`)
must be saved e.g. by using volumes, and probably also that the configuration is
expected at `/etc/dovecot/dovecot.conf`.
>
/var/mail is for per-user mail data in a system where each system user has a
mailbox.
> Stay healthy and have a nice day,
>
> --
> Thomas Bellebaum <thomas at bellebaum.eu>
I don't see much reason here to remove either volume, as most people will
anyways need to use them. You can only do so much static config file. If you
want to use SSL or any user database/password database you'll need more
config files.
Aki