
実現したいこと
- E2C内でコンテナ化したpostfixからsendmailをできるようにしたいのですが、sendmail時にアイドル状態が長くうまく送信できないようです。ほかに何か必要な手順など心当たりがあったらご教授願います。
前提
コンテナ化したpostfixでsendmailできるところまで構築してます。
・EC2のインスタンスを立て、セキュリティグループやIPの紐付けなどを行いSSH接続可能な所までは行ってます。
・Ubuntu上でDocker、Conposeをインストールしました。
・postfixコンテナ設立に必要なyamlファイルはこちらを利用しています。
・MailTrapの登録は登録は済んでいます。
・コンテナのビルド、起動するところまでは確認済み
発生している問題・エラーメッセージ
#EC2(Ubuntu) root@c5db87XXXXX:/# sendmail XXXXXXXXXXX@gmail.com _ #コマンド実行後いくら経ってもアイドル状態
ソースコード
#docker-compose.yml version: '3.8' services: docker-ubuntu-postfix-example: build: context: ./ dockerfile: Dockerfile image: docker-ubuntu-postfix-example-image:latest container_name: docker-ubuntu-postfix-example-container volumes: # Postfixの設定をマウントする - type: bind source: ./configs/main.cf target: /etc/postfix/main.cf # SASL認証のパスワードをマウントする - type: bind source: ./configs/sasl_passwd target: /etc/postfix/sasl_passwd
#Dockerfile FROM ubuntu:20.04 # postfixをインストールする為に、パッケージを更新 RUN apt update && apt upgrade -y # postfixをインストール RUN DEBIAN_FRONTEND=noninteractive apt install postfix -y # SMTPリレーにはSMTP AUTHが必要。 # SMTP AUTHの為のSASLにはCyrus SaslとCyrus IMAPを使う。 RUN apt install sasl2-bin -y RUN DEBIAN_FRONTEND=noninteractive apt install cyrus-imapd -y # コンテナ起動時のスクリプト COPY ./entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"]
#entrypoint.sh #!/bin/bash # postfixの起動 postfix start # Postfixは/var/spool/postfixにchrootするので、 # 名前解決に際して、/etc/resolv.confではなく/var/spool/postfix/etc/resolv.confを見に行く。 # 従って、/etc/resolv.confをコピーする。 cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf # SASL認証用のテーブル作成 chown root:root /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd # postfixの設定変更を反映させる postfix reload # コンテナの起動を維持するため tail -f /dev/null
#main.cf # ログの出力設定 maillog_file = /var/log/mail.log # SMTPリレーの設定 relayhost = smtp_sasl_auth_enable = smtp_sasl_mechanism_filter = smtp_sasl_security_options = smtp_sasl_password_maps =
#sasl_passwd #MailtrapPostfixの設定文字列 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー