Docker容器网络上的Spring Boot不稳定

时间:2019-07-15 01:09:46

标签: java spring docker

我有一个在Linux上运行docker容器的spring boot应用程序。 该应用程序正在向内部员工发送大量电子邮件。 每晚大约有1万封电子邮件要发送。 每封电子邮件大约需要5毫秒才能发送。 邮件服务器和docker spring在同一公司网络中

问题是,Docker中的邮件应用程序有时无法连接到邮件服务器。

$articles = $client->search($params);
$hits = $articles['hits']['hits'];

for($i=0; $i<count($hits); $i++){
    $hits[$i]['_source']['count_mentions'] = substr_count($hits[$i]['highlight']['content'][0],"<em>");
}

但是,如果我在没有docker的情况下运行Spring Boot应用程序,则在同一台机器上,一切正常(所有电子邮件已发送并且未记录错误消息)

码头工人网络似乎不稳定。

这是否需要调整? 这是我创建容器的dockerfile

Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: xxx.xxx.xxx, port: 25, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: xxx.xxx.xxx, port: 25, response: -1

0 个答案:

没有答案