Skip to content

rea1shane/lego-docker-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lego Docker helper

Use Docker label to determine which certificates should be deployed to which containers and deploy them via the Docker client.

No changes were made other than installing docker-cli and helper.sh on the original image. See Dockerfile.

Features:

  • Use crond as daemon.
  • Provide some useful functions (demo):
    • docker_copy_by_label: Copy certificates to containers with specified Docker label.
    • docker_exec_by_label: Execute command in containers with specified Docker label.
    • docker_restart_by_label: Restart containers with specified Docker label.

Usage

First, adding labels to containers where certificates need to be deployed, like this. Then down and up containers to make labels take effect.

Second, make your own hook script, like this.

Then, up lego-docker-helper container and mount docker.sock in it with rw permission, like this. Also don't forget to mount your hook script into the container.

Important

By default, container use UTC. To set cron expressions by local time, specify your time zone with the environment variable TZ when start the container, like this. See list with all the timezones.

Finally, do anything else as you did before with Lego.

Tip

Edit cron jobs via crontab -e to ensure that crond can be reloaded.