Configuring Postfix Directives via Docker Compose Environment Variables Estimated Reading Time: 1 Minutes You can easily configure Postfix settings in a Ubersmith's mail service by using environment variables in your docker-compose.override.yml file. This approach allows you to override Postfix's main.cf directives without directly editing configuration files inside the container. How It Works For any Postfix directive, you can set its value by adding an environment variable in the format: POSTCONF_MAIN_CF_DIRECTIVE_NAME Replace MAIN_CF_DIRECTIVE_NAME with the uppercase name of the directive from Postfix's main.cf For example, to set the message_size_limit directive, use: POSTCONF_MESSAGE_SIZE_LIMIT=10240000 This will set the message_size_limit in Postfix's main.cf to 10,240,000 bytes (approximately 10 MB). Example Configuration In your docker-compose.override.yml file, add the environment variable under the mail service: mail: volumes: # ...existing volume directives... environment: # ...other environment variables... - POSTCONF_MESSAGE_SIZE_LIMIT=10240000 Applying the Change After updating your configuration, recreate the mail container to apply the new setting: docker compose up -d mail Notes This method works for any Postfix directive. For example, to set myhostname, use POSTCONF_MYHOSTNAME=mail.example.com. If you are already overriding the Postfix main.cf using a volume mount, this method may not have any effect. Example Directives Table Postfix Directive Environment Variable Example Value message_size_limit POSTCONF_MESSAGE_SIZE_LIMIT 10240000 myhostname POSTCONF_MYHOSTNAME mail.example.com smtpd_banner POSTCONF_SMTPD_BANNER My Mail Server Ready