Container used for cronjob and mail sending via SMTP relay in kubernetes.
Example command:
curl https://some.website.com/api | mailx -r "[email protected]" -s "Email subject" -S smtp="10.0.0.1" [email protected]
Dockerfile
FROM centos:7
RUN yum -y install mailx; yum clean all;
CMD ["/usr/bin/bash"]
github repo: https://github.com/icebrian/docker-mailx
And here is kubernetes cronjob example:
apiVersion: batch/v1
kind: CronJob
metadata:
name: web-cron
namespace: web-cron
spec:
schedule: "30 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: web-cron
image: icebrian/docker-mailx:0.1
imagePullPolicy: IfNotPresent
command:
- /usr/bin/bash
args:
- -c
- /usr/bin/curl https://some.web.address/api | /usr/bin/mailx -r '[email protected]' -s 'email subject' -S smtp='10.0.0.7' [email protected] && sleep 10
restartPolicy: Never
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 2
Content type
Image
Digest
Size
79 MB
Last updated
over 4 years ago
docker pull icebrian/docker-mailx:0.1