Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myhostname is added after each restart #37

Closed
denis-antonik opened this issue Oct 5, 2020 · 5 comments
Closed

myhostname is added after each restart #37

denis-antonik opened this issue Oct 5, 2020 · 5 comments

Comments

@denis-antonik
Copy link

After each restart of dockers in main.cf file (on volume) added new string with myhostname, old string with this param are commented.

#myhostname = 214c7f4ad504
mynetworks = 127.0.0.0/8,172.20.0.0/16
#myhostname = 73c3c5480272
#myhostname = postfix-smtp-relay
#myhostname = postfix-smtp-relay
myhostname = postfix-smtp-relay

Part of my docker-compose

  postfix-smtp-relay:
    image: boky/postfix
    container_name: postfix-smtp-relay
    hostname: postfix-smtp-relay
    environment:
      POSTFIX_myhostname: postfix-smtp-relay
      POSTFIX_maillog_file: "/var/log/mail.log"
      LOG_FORMAT: plain
      MYNETWORKS: "127.0.0.0/8,172.20.0.0/16"

Only this parameter is repeated, is this expected behavior or a bug?

@bokysan
Copy link
Owner

bokysan commented Oct 6, 2020

Interesting -- I'll have a look a the code.
I have never expected main.cf to be stored on a persistent volume.

@denis-antonik
Copy link
Author

In your Dockerfile contains

# Set up volumes
VOLUME [ "/var/spool/postfix", "/etc/postfix", "/etc/opendkim/keys" ]

@denis-antonik
Copy link
Author

denis-antonik commented Oct 7, 2020

Duplications occur not only in this file, but also in others:
postmap: warning: /etc/postfix/sasl_passwd.db: duplicate entry: "smtp.postmarkapp.com"
and really in /etc/postfix/sasl_passwd many duplicated string (count like in main.cf)

If I do not explicitly specify the volume in docker-compose, it is still created, just not named (with name like "21f27daf942e69ee3792a54ce3f708144").
If I restart dockers (docker-compose down && docker-compose build && docker-compose up -d) will be created new volume with different name ("85dc3f8987fac1cb4ad35a19b68c16299"), and every restart will be added new volume.
In files no duplications, but number of volumes are growing.

bokysan added a commit that referenced this issue Oct 24, 2020
While quite annoying behavour, this is the how `postconf` works.
If you tell it to comment out a command, it will add it to the config
even when the same command exists commented out in the config file.

This commit does a bit of sed and grep magic to find if the comment
already exists and if yes, then it does nothing.
bokysan added a commit that referenced this issue Oct 24, 2020
@bokysan
Copy link
Owner

bokysan commented Oct 24, 2020

This should be resolved in the latest master.

@bokysan bokysan closed this as completed Oct 24, 2020
@denis-antonik
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants