Issue during sent an allert notification to smtp.gmail.com 587

Hello all,
It is the first time I write in this forum…
I’m a recent user of docker and i’m trying to run prometheus and alertmanager under docker,
under two different version of ubuntu.

Under ubuntu 20:04.5 LTS running under Virtual box no issues, the email was sent without problems.

Under Ubuntu 22.04.1 LTS every time an issue apperas, the alert manage try to send an email but following error compares:

level=error ts=2023-02-16T14:12:42.570Z caller=dispatch.go:354 component=dispatcher msg=“Notify for alerts failed” num_alerts=1 err=“mail/email[0]: notify retry canceled after 2 attempts: send STARTTLS command: read tcp 172.20.0.3:56452->108.177.96.109:587: read: connection reset by peer”

I tried a telnet connection (telnet smtp.gmail.com 587) from alertmanager docker and it works well
as you can see

/alertmanager # telnet “smtp dot gmail dot com” 587
Connected to "smtp dot gmail dot com
220 smtp.gmail.com ESMTP k12-20020a1709061c0c00b008b17aae2a01sm104153ejg.86 - gsmtp
/alertmanager #
/alertmanager #

Any suggestion about this issue?

Many thanks to all in advance.

Gabriele