3 Docker
Rishit Bansal edited this page 2020-02-29 14:28:40 +05:30

Obtaining the Docker image

To pull the latest pre-built image of wildduck from docker hub:

docker pull nodemailer/wildduck

It is also possible to pull a specific version of wildduck by specifying the version as the image tag. (example, for version 1.20):

docker pull nodemailer/wildduck:1.20

Environment variables in the Docker image

The following docker env variables are available inside the container:

  1. WILDDUCK_APPDIR: The folder where wildduck is installed inside the container
  2. WILDDUCK_CONFIG: Path to the config file to be used with wildduck
  3. CMD_ARGS: Any additional cmd options to pass to wildduck running inside the docker container

Running wildduck using Docker

The image is configured to use the default config file

docker run nodemailer/wildduck

This is likely to fail due to mongodb and redis not present in localhost inside the container. To pass custom configuration options/files to wildduck inside the docker image, the following two strategies can be used:

  1. Pass CMD_ARGS to configure options using wild-config

    To set a custom mongo and redis host, and configure the FQDN and the domain for receiving emails:

    FQDN='example.com'
    MAIL_DOMAIN='mail.example.com'
    docker run --env CMD_ARGS="\
    --dbs.mongo=mongodb://mongo:27017/ \
    --dbs.redis=redis://redis:6379/3 \
    --smtp.setup.hostname=$FQDN \
    --log.gelf.hostname=$FQDN \
    --imap.setup.hostname=$FQDN \
    --emailDomain=$MAIL_DOMAIN" \
    nodemailer/wildduck 
    

    More details available at the wild-config documentation.

  2. Mount a Docker volume with a custom configuration file:

    To replace the default config folder (/wildduck/config) inside the docker image

    docker run -v '/config/from/host:/wildduck/config' nodemailer/wildduck