If you don't have private key for opendkim signature, dont' worry, it will be auto-generated.
docker run \
-d \
-e DKIM_DOMAIN=example.com \
-e DKIM_SELECTOR=mail \
glavich/docker-postfix:latest
On container generation, DNS TXT setting will be dumped to logs. You can see it by typing: docker logs CONTAINER_ID
(for example docker logs 5bcc4f4f186e
or docker logs amazing_banach
).
If you already have your own private key for opendkim signature, just add it to container folder: /etc/opendkim/keys/
. Be sure to name it SELECTOR.private
(if selector is mail
, then name file mail.private
).
docker run \
-d \
-e DKIM_DOMAIN=example.com \
-e DKIM_SELECTOR=mail \
-v $(pwd)/mail.private:/etc/opendkim/keys/mail.private \
glavich/docker-postfix:latest
With following command, private key (mail.private
) and dns txt setting (mail.txt
)file, will be generated in your current folder.
docker run \
--rm \
-v $(pwd):/x \
glavich/docker-postfix:latest \
opendkim-genkey \
-b 1024 \
-d example.com \
-D /x \
-h sha256 \
-r \
-s mail \
-v
More on opendkim-genkey
options can be read here: http://www.opendkim.org/opendkim-genkey.8.html