OK, so the smart thing to do is to forget about sendmail and use the docker container bytemark/smtp to create a mail server and then connect and send from the python container.
bytemark/smtp