SMTP doesn't work with docker-compose container

no1123582 years ago

Hello, I've been playing with docker-compose to setup a personal traccar container and I got it working, except SMTP is stubborn. If anyone can bring some illumination to this problem, i'd be grateful. GPS devices are also working.

Error message:

No SMTP configuration found - MessagingException (SmtpMailManager:112 < *:98 < NotificatorMail:44 < NotificationResource:96 < ...)

traccar.xml :

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./conf/default.xml</entry>

    <!--

    This is the main configuration file. All your configuration parameters should be placed in this file.

    Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
    with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.

    For list of available parameters see following page: https://www.traccar.org/configuration-file/

    -->

    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:./data/database</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'></entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.starttls.enable'>true</entry>
    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.from'>someemail@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>someemail@gmail.com</entry>
    <entry key='mail.smtp.password'>apppassword</entry>
</properties>

docker-compose.yaml :

version: "3"
services:
  traccar:
    image: "traccar/traccar:latest"
    container_name: somename_traccar
    restart: always
    ports:
      - "5000-5150:5000-5150"
      - "5000-5150:5000-5150/udp"
      - "8082:8082"
      - "587:587"
    volumes:
      - ./traccar.xml:/opt/traccar/traccar.xml:ro
      - ./logs:/opt/traccar/logs:rw
      - ./data:/opt/traccar/data:rw
networks:
  default:
    external:
      name: somenetworkname
Anton Tananaev2 years ago

You can only get this error if mail.smtp.host is missing, which probably means your server is using some other config file. Have you restarted after changing the config?

no1123582 years ago

The container was restarted many times via docker recreate and docker restart id.

I'll check into mail.smtp.host missing. I don't really know what you mean but I'll check the net.