Home Server (Rocky Linux 8, Containerized with Podman)

if you use a cronjob on the host, it's not containerized. At that point, just install certbot on the host.

Once, when I needed cron in a container application, I just created a container just for it, running alpine and crond -- docker kept it running. My dockerfile looked like this:

FROM python:alpine

RUN pip install speedtest-cli sqlalchemy

COPY scripts /scripts
# copy crontabs for root user
COPY cronjobs /etc/crontabs/root

# start crond with log level 8 in foreground, output to stderr
CMD ["crond", "-f", "-d", "8"]

But it suffers from the same issues as before: you need to issue commands to other containers. You can, but it's not easy.

Of course you can restart nginx even when you do not renew a certificate. But, that's not very clean. I'd look at caddy if you want something more container native.

2 Likes