HUB
Sign inSign up
lego logo

11notes/lego

By 11notes

•Updated 2 days ago

run LEGO on a schedule, rootless and distroless.

Buildkit cache
Image
0

10K+

11notes/lego repository overview

banner

⁠LEGO

size5pxpulls5px5pxswiss_made

run LEGO on a schedule, rootless and distroless.

⁠INTRODUCTION 📢

Let's Encrypt client and ACME library written in Go.

⁠CAUTION ⚠️

v5 of LEGO will use the new yml config and will not work with your existing pre v5 config, please convert your exisiting config into the new format. The format can be found here⁠.

⁠SYNOPSIS 📖

What can I do with this? This image will give you a rootless⁠ and distroless⁠ LEGO installation to automate your cert creation for systems that do not support ACME.

⁠UNIQUE VALUE PROPOSITION 💶

Why should I run this image and not the other image(s) that already exist? Good question! Because ...

  • ... this image runs rootless⁠ as 1000:1000
  • ... this image has no shell since it is distroless⁠
  • ... this image is auto updated to the latest version via CI/CD
  • ... this image has a health check
  • ... this image runs read-only
  • ... this image is automatically scanned for CVEs before and after publishing
  • ... this image is created via a secure and pinned CI/CD process
  • ... this image runs a basic integration test before it will be published (or not if it fails)
  • ... this image is very small
  • ... this image support inline configs⁠

If you value security, simplicity and optimizations to the extreme, then this image might be for you.

⁠VOLUMES 📁

  • /lego/etc - Directory of your Let's Encrypt config
  • /lego/var - Directory of your Let's Encrypt certificates and accounts

⁠COMPOSE ✂️

name: "letsencrypt"

x-lockdown: &lockdown
  # prevents write access to the image itself
  read_only: true
  # prevents any process within the container to gain more privileges
  security_opt:
    - "no-new-privileges=true"

services:
  lego:
    image: "11notes/lego:5.6.0"
    <<: *lockdown
    environment:
      TZ: "Europe/Zurich"
      LEGO_CONFIG: |-
        challenges:
          cf:
            dns:
              provider: cloudflare
              envFile: /run/secrets/cf
              resolvers:
                - 8.8.8.8:53
                - 1.1.1.1:53
                - 9.9.9.9:53

        certificates:
          ${FQDN}:
            challenge: cf
            domains:
              - "${FQDN}"
              - "*.${FQDN}"
            renew:
              reuseKey: false
            pfx:
              password: lego1234
              format: SHA256

        storage: /lego/var
        accounts:
          default:
            acceptsTermsOfService: true
        log:
          level: info
          format: text
    volumes:
      - "lego.etc:/lego/etc"
      - "lego.var:/lego/var"
    tmpfs:
      # needed for read-only
      - "/run/secrets:uid=1000,gid=1000"
    secrets:
      - "cf"
    networks:
      frontend:
    restart: "always"

volumes:
  lego.etc:
  lego.var:

networks:
  frontend:

secrets:
  cf:
    file: "./cloudflare.txt"

To find out how you can change the default UID/GID of this container image, consult the RTFM⁠.

⁠DEFAULT SETTINGS 🗃️

ParameterValueDescription
userdockeruser name
uid1000user identifier⁠
gid1000group identifier⁠
home/legohome directory of user docker

⁠ENVIRONMENT 📝

ParameterValueDefault
TZTime Zone⁠
DEBUGWill activate debug option for container image and app (if available)
LEGO_CONFIGWill overwrite the default config with the value of this variable if set (inline config⁠)
TRAEFIK_ROOTIf this env is defined all the certificates will be symbolic linked to /lego/var/traefik and a lego.yml config will be generated for Traefik containing the base path defined in this variable. You can then simply copy the contents of this folder to your dynamic Traefik config.

⁠MAIN TAGS 🏷️

These are the main tags for the image. There is also a tag for each commit and its shorthand sha256 value.

⁠There is no latest tag, what am I supposed to do about updates?

It is my opinion that the :latest tag is a bad habbit and should not be used at all. Many developers introduce breaking changes in new releases. This would messed up everything for people who use :latest. If you don’t want to change the tag to the latest semver⁠, simply use the short versions of semver⁠. Instead of using :5.6.0 you can use :5 or :5.6. Since on each new version these tags are updated to the latest version of the software, using them is identical to using :latest but at least fixed to a major or minor version. Which in theory should not introduce breaking changes.

If you still insist on having the bleeding edge release of this app, simply use the :rolling tag, but be warned! You will get the latest version of the app instantly, regardless of breaking changes or security issues or what so ever. You do this at your own risk!

⁠REGISTRIES ☁️

docker pull 11notes/lego:5.6.0
docker pull ghcr.io/11notes/lego:5.6.0
docker pull quay.io/11notes/lego:5.6.0

⁠SOURCE 💾

⁠PARENT IMAGE 🏛️

This image is not based on another image but uses scratch⁠ as the starting layer. The image consists of the following distroless layers that were added:

  • 11notes/distroless⁠ - contains users, timezones and Root CA certificates, nothing else
  • 11notes/distroless:lego

⁠BUILT WITH 🧰

⁠GENERAL TIPS 📌

  • Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS and to protect your endpoints
  • Use Let’s Encrypt DNS-01 challenge to obtain valid SSL certificates for your services

⁠ElevenNotes™️

This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the releases⁠ for breaking changes. If you have any problems with using this image simply raise an issue⁠, thanks. If you have a question or inputs please create a new discussion⁠ instead of an issue. You can find all my other repositories on github⁠.

created 16.11.2026, 22:23:03 (CET)

Tag summary

Content type

Image

Digest

sha256:56c9696db…

Size

49.2 MB

Last updated

2 days ago

docker pull 11notes/lego:5.6.0-unraid