Docker Compose configurations for deploying Portainer EE with automated Let's Encrypt SSL certificates via DNS-01 challenge (Route53).
portainer/ # Portainer EE server with SSL and cert automation
docker-compose.yaml
.env.example # Template for required environment variables
portainer-agent/ # Standalone Portainer Agent for remote endpoints
docker-compose.yaml
The main compose file deploys three services:
- Portainer EE — management UI served over TLS on port
9443 - Certbot — obtains and stores Let's Encrypt certificates using the
dns-route53plugin - Ofelia — cron scheduler that renews certificates weekly and restarts Portainer when certs are updated
The Portainer Agent is included via compose include from portainer-agent/docker-compose.yaml.
A standalone Portainer Agent deployment on port 9001, suitable for adding remote Docker endpoints to your Portainer instance.
- Docker Engine with Compose V2 (
docker compose) - An AWS Route53-hosted domain (for DNS-01 certificate validation)
- AWS credentials with Route53 permissions
-
Clone the repository:
git clone https://github.com/hjmcnew/portainer-docker-compose.git cd portainer-docker-compose -
Create a
.envfile in theportainer/directory with your configuration. A template is provided atportainer/.env.example:cp portainer/.env.example portainer/.env
DOMAIN=portainer.example.com EMAIL=you@example.com AWS_ACCESS_KEY_ID=your-key-id AWS_SECRET_ACCESS_KEY=your-secret-key
-
Start the stack:
cd portainer docker compose up -dCertbot will obtain a certificate on first run. The healthcheck waits for the cert to be issued before Portainer starts.
-
Access Portainer at
https://your-domain:9443.
To deploy just the Portainer Agent on a remote host:
cd portainer-agent
docker compose up -dOfelia handles automated renewal on a weekly schedule:
- Certbot attempts renewal and sets a flag file if the certificate was updated
- A follow-up job checks for the flag, restarts Portainer to load the new cert, and clears the flag
No manual intervention is required.
GitHub Actions workflows run on push and pull requests to main:
- Docker Compose Lint — validates compose files using dclint
- KICS — scans infrastructure-as-code for security issues and uploads SARIF results to GitHub code scanning
- Super-Linter — runs super-linter across changed files
- zizmor — audits GitHub Actions workflows with zizmor
- Renovate — monitors Docker image and GitHub Actions updates weekly (major version bumps are disabled); see
renovate.json
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/your-feature-name). - Open a Pull Request.
This project is licensed under the BSD 3-Clause License — see the LICENSE file for details.