for i in `docker network ls | awk '{ print $1 }' `; do echo $i; (docker network inspect $i ); done
# To find which image did the SMTP message : we used :
While
journalctl -f
will give trace of all the logs (assuming /etc/docker/daemon.json is setup correctly) - but it will not identify which container the logs come from.
Here we needed to find which container was making the SMTP call - so we did this :
for i in `docker ps | awk '{ print $1 }' `; do echo $i; (docker logs $i 2>&1 | grep SMTP); done
Gave us the container : 143701b52e37 as the container tryign to connect to the mail server.
143701b52e37
Jul 19 05:34:28 islandportal.example.com dockerd[27108]: WARNING: 4: Unable to send email: Unknown SMTP host: mail.example.com. Exception caught!
Then we could connect to that container :
docker exec -it 143701b52e37 sh
to print out the network and test resolving the SMTP host name: