I am trying to create a postfix container.
What I want to do is to send emails from another container.
Here is what I've done:
FROM ubuntu:latest
RUN apt-get update && apt install -y postfix
COPY main.cf /etc/postfix/main.cf
COPY master.cf /etc/postfix/master.cf
COPY mynetworks /etc/postfix/mynetworks
COPY mydestinations /etc/postfix/mydestinations
CMD service postfix restart && tail -f /dev/null
It works but I want to improve it.
I don't want any external configuration files dependencies: master.cf and main.cf. Is there a way, to say, in a Dockerfile: remove this line from main.cf and add this one instead. I have tried to do it with bash script but it is ugly. Is there a Dockerfile command to say: "I want to set this variable in this configuration file with this value" ?
I need to put my second docker container IP in /etc/postfix/mynetworks file. But this IP address may change other time. I have tried to put its hostname in /etc/postfix/mynetworks but it doesn't work. How can I do ?
Thanks