Let's Encrypt
Container
This container sets up an Nginx webserver and reverse proxy with php support and a built-in letsencrypt client that automates free SSL server certificate generation and renewal processes. It also contains fail2ban for intrusion prevention. Before running this container, make sure that the url and subdomains are properly forwarded to this container's host. - Port 443 on the internet side of the router should be forwarded to this container's port 443. - If you need a dynamic dns provider, you can use the free provider duckdns.org where the url will be yoursubdomain.duckdns.org and the subdomains can be www,ftp,cloud - The container detects changes to url and subdomains, revokes existing certs and generates new ones during start. - It also detects changes to the DHLEVEL parameter and replaces the dhparams file. - If you'd like to password protect your sites, you can use htpasswd. Run the following command on your host to generate the htpasswd file docker exec -it letsencrypt htpasswd -c /config/nginx/.htpasswd <username>
Image details
Configuration
TypeContainerlinuxlinuxserver/letsencrypt:latest80/tcp443/tcp/config : /portainer/Files/AppData/Config/LetsEncryptEMAIL=-Xms256m -Xmx512mURL=-Xms256m -Xmx512mSUBDOMAINS=www,ONLY_SUBDOMAINS=falseDHLEVEL=2048PUID=1000PGID=100VALIDATION=httpDNSPLUGIN=httpunless-stoppedTemplate by SelfhostedPro
Standalone Install
Select an install method, to see config/commands for deploying Let's Encrypt
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Let's Encrypt, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
More install options in our documentation.
IMPORTANT NOTICE: THIS IMAGE HAS BEEN DEPRECATED AND THE PROJECT IS MOVED TO A NEW REPO
Due to a trademark related request, this image is moved to a new repo on Docker Hub and GitHub. This is a breaking change and you need to manually update. Apologies for the the disruption.Switching existing implementations over to the new image is very easy, just follow these simple steps: https://github.com/linuxserver/docker-swag#migrating-from-the-old-linuxserverletsencrypt-image

The LinuxServer.io team brings you another container release featuring :-
regular and timely application updates easy user mappings (PGID, PUID) custom base image with s6 overlay weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth regular security updates
Find us at:
- Discord - realtime support / chat with the community and the team.
- IRC - on freenode at
#linuxserver.io. Our primary support channel is Discord. - Blog - all the things you can do with our containers including How-To guides, opinions and much more!
linuxserver/letsencrypt
Letsencrypt sets up an Nginx webserver and reverse proxy with php support and a built-in letsencrypt client that automates free SSL server certificate generation and renewal processes. It also contains fail2ban for intrusion prevention.

NOTICE:
It seems our readme has gotten too large and is no longer syncing to Docker Hub description. Please view the full readme at https://github.com/linuxserver/docker-letsencrypt/blob/master/README.mdServe Let's Encrypt on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.
Proxying let-s-encrypt.example.com to http://letsencrypt:80
Add this to your Caddyfile
let-s-encrypt.example.com {
reverse_proxy http://letsencrypt:80
}Check the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs letsencrypt - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Published on a random port
This template exposes 80/tcp without setting a host port,
so Docker picks a random free one on every deploy.
- Find it in the Ports column of Portainer's container list, or with
docker port letsencrypt
Permission denied on volumes
If the logs show "permission denied", the app can't write to its data folder on the host.
- Fix the ownership:
sudo chown -R 1000:100 /portainer/Files/AppData/Config/LetsEncrypt - Or set the
PUIDandPGIDvariables (defaults 1000:100) to match your own user, found withid $USER
Image won't pull
Test the pull directly on the host: docker pull linuxserver/letsencrypt:latest
- "manifest unknown" means the tag no longer exists. This template uses
latest, so try pinning a specific version instead. - "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- This image supports:
amd64, arm64, arm, arm64/v8 - Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect letsencrypt --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue within letsencrypt's repo
- Template not working: Open an issue on SelfhostedPro/selfhosted_templates
- This website not working: Open an issue on lissy93/portainer-templates
A single container
Let's Encrypt runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.
The app image
An image is the app packed up ready to go, everything Let's Encrypt needs bundled into one download. This template pulls linuxserver/letsencrypt:latest, which Docker fetches once and then starts your own copy from.
Where the image comes from
Docker pulls its images from registries, public libraries of ready-built apps. Let's Encrypt's comes from Docker Hub, published by linuxserver.
Version tags
The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Pin a specific tag if you would rather stay on one version.
Which machines it runs on
Every image is built for particular CPU types. This one ships for amd64, arm64, arm, arm64/v8, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.
Ports
A port is the door the app answers on. Here the app exposes a port but leaves the host side blank, so Docker picks a free one for you. It opens:
80, published on a random host port443, published on a random host port
Volumes
A volume is where Let's Encrypt keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/configfrom/portainer/Files/AppData/Config/LetsEncrypton the host
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Let's Encrypt takes 9 of them, all with defaults you can leave alone or tweak:
EMAIL, defaults to-Xms256m -Xmx512mURL, defaults to-Xms256m -Xmx512mSUBDOMAINS, defaults towww,ONLY_SUBDOMAINS, defaults tofalseDHLEVEL, defaults to2048PUID, defaults to1000PGID, defaults to100VALIDATION, defaults tohttpDNSPLUGIN, defaults tohttp
Restart policy
The restart policy here is unless-stopped, so Docker restarts Let's Encrypt after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Users and permissions
The PUID and PGID settings tell it which user and group to act as on your host. Point them at your own account (find yours with id $USER) so the files it writes into your mounted folders come out owned by you rather than root.
Networking
Nothing custom is set, so Let's Encrypt sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.
Container name
Once it's deployed, Portainer names the container letsencrypt. That's what you'll spot in the containers list and use in commands like docker logs letsencrypt.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Let's Encrypt up. Add the template list to Portainer once, then deploying Let's Encrypt is a click rather than a wall of config.