A hacky way to get it done#

docker-compose.yml

  certbot:
    image: certbot/certbot:latest
    depends_on:
      - nginx
    command: >-
      renew -v --webroot --webroot-path=/var/www/certbot --agree-tos --email "my-email"
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw

Run:

docker compose up certbot