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

usage with docker-compose #104

Closed
stefangweichinger opened this issue Apr 19, 2023 · 2 comments
Closed

usage with docker-compose #104

stefangweichinger opened this issue Apr 19, 2023 · 2 comments

Comments

@stefangweichinger
Copy link

Trying this:

# cat docker-compose.yml 
version: '3.7'

networks:
  back-tier:

services:

  postfix-exporter:
    image: chatwork/kumina-postfix-exporter:latest
    volumes:
      - /var/spool/postfix/public/showq:/var/spool/postfix/public/showq:ro
      - /var/log/mail.log:/var/log/mail.log:ro
    command:
      - '--web.listen-address=":9154"'
      - '--postfix.logfile_path="/var/log/mail.log"'
        #- '--systemd.enable'
    ports:
      - 9154:9154
    networks:
      - back-tier
        #restart: always

Getting:

# docker-compose up
[+] Running 2/2
 ⠿ Network postfix-exporter_back-tier             Created                                                                                                                                                                                 0.1s
 ⠿ Container postfix-exporter-postfix-exporter-1  Created                                                                                                                                                                                 0.1s
Attaching to postfix-exporter-postfix-exporter-1
postfix-exporter-postfix-exporter-1  | 2023/04/19 11:23:39 Reading log events from "/var/log/mail.log"
postfix-exporter-postfix-exporter-1  | 2023/04/19 11:23:39 Failed to create PostfixExporter: open "/var/log/mail.log": no such file or directory
postfix-exporter-postfix-exporter-1 exited with code 1

Tried to mount the directory /var/log also, same problem.

/var/log/mail.log exists on the host with read permissions. Help welcome ....

@maxkratz
Copy link

Not sure if this works nowadays, but on my old mail server, I've used this docker-compose.yml file to run the postfix exporter:

version: '3.2'

services:
  postfix-exporter:
    # use local Dockerfile to build image
    build: .
    # mount spool and logfiles as read only to container
    volumes:
      - /var/spool/postfix:/var/spool/postfix:ro
      - /var/log/mail.log:/var/log/mail.log:ro
    # map ports to host 
    ports:
      - 9154:9154
    restart: unless-stopped

Maybe this helps.

@stefangweichinger
Copy link
Author

@maxkratz thanks for the speedy reply. I started from scratch and now it builds and starts up. Thanks! I now try to integrate this with the prometheus-container ... another issue.

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