Mailcow-dockerized: Mailcow volumes in other directory

Created on 1 Jun 2018  路  4Comments  路  Source: mailcow/mailcow-dockerized

I know there is this option, but (and correct me if I'm mistaken) AFAIK that moves every docker volume to that directory, even non-mailcow things. Is there a way to only change the mailcow volumes? Like adding something to mailcow.conf like:

MAILCOW_DATA_DIR=directory

or

MAILCOW_VMAIL_DIR=directory
MAILCOW_MYSQL_DIR=directory
etc

Or is my only option is to edit the docker-compose.yml file for something like that? I really dont want to do that, since that will complicate things with updates. I guess I could make links in /var/lib/docker/volumes for each mailcow volume, but was wondering if there are other options.

Most helpful comment

You can create a file

docker-compose.override.yml

version: '2.1'
volumes:
  vmail-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/vmail
      o: bind
  mysql-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/mysql
      o: bind
  redis-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/redis
      o: bind
  rspamd-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/rspamd
      o: bind
  postfix-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/postfix
      o: bind
  crypt-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/crypt
      o: bind
  rspamd-sock:
    driver_opts:
      type: none
      device: /data/mailcow/rspamd-sock
      o: bind

All 4 comments

You can create a file

docker-compose.override.yml

version: '2.1'
volumes:
  vmail-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/vmail
      o: bind
  mysql-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/mysql
      o: bind
  redis-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/redis
      o: bind
  rspamd-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/rspamd
      o: bind
  postfix-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/postfix
      o: bind
  crypt-vol-1:
    driver_opts:
      type: none
      device: /data/mailcow/crypt
      o: bind
  rspamd-sock:
    driver_opts:
      type: none
      device: /data/mailcow/rspamd-sock
      o: bind

That's a cool way we should mention in the docs. :-) Do you want to create a PR?

It gave me a error when using it, something about wrong version. After adding version number from the docker-compose.yml to file it worked ok.

Yes, the version needs to be specified. Can you fix that. @daschxx ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

K2rool picture K2rool  路  3Comments

a3li picture a3li  路  3Comments

patrick7 picture patrick7  路  3Comments

mritzmann picture mritzmann  路  3Comments

damdinsharav picture damdinsharav  路  3Comments