lightweight mail parser running on docker

Viewed 40

A while ago I created a vm running postfix and s-nail to pipe mails to a bash script. The script then verifies the sender and recipient, scans for some keywords and does a http GET request. It is a restricted service running only on our local network.

Now I would like to forge this into a docker image. As I am new to creating Docker Images, I need some help.

How can I pack postfix, s-nail and the script into a Docker image? Do the services need to be separated or can it be one single container?

1 Answers

There are many different ways to do that.

You can put it all together in a one single docker-image. You can use ubuntu as a base image and install your software on it. It's works and is simple. Perhaps it is a good starting-point to learn docker.

FROM ubuntu

# install deps with normal apt
RUN apt update && apt install postfix s-nail

# and you need an entrypoint, which will start both services

But generally, we try to put only one service in a container. If you want to split up, you need a way orchestrate them (spinning containers up, ensure that containers can talk to each other).

If you want to split up, then I recommend docker-compose. It's very easy.
If you want a more advanced setup, then you can use kubernetes.

Related