2

Hello I'm trying to run the following command in my container

mail -s "This is Subject" someone@example.com < /path/to/file

How should my dockerfile look so the above command can be executed ?

I tried the following solution

https://stackoverflow.com/questions/40890011/ubuntu-dockerfile-mailutils-install

FROM ubuntu:latest
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install -y mailutils

but I get this error

The command '/bin/sh -c apt-get update && apt-get install -y mailutils' returned a non-zero code: 100

I also tried some examples like this

https://github.com/42technologies/docker-postfix-gmail

FROM ubuntu:14.04

RUN apt-get update
RUN apt-get install -y mailutils
RUN echo "postfix postfix/mailname string gmail.com" | debconf-set-selections
RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
RUN apt-get install -y postfix

ADD mail.sh /mail.sh
RUN chmod +x /mail.sh

ENTRYPOINT ["/mail.sh"]  

But I don't won't the container to only send emails because I'm customizing a specific container and I just want to enable the sending email features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.