Create and Apply SSL Certificates for Portainer @i12bretro
Create and Apply SSL Certificates for Portainer  @i12bretro
Uploaded June 2023 | Updated September 2026, 2 weeks ago
#Portainer #SSL #HTTPS

Full steps can be found at i12bretro.github.io/tutorials/0597.html

Prerequisites
   - A XCA PKI database  youtu.be/ezzj3x207lQ
 
Create Your SSL Certificate
   01. Launch XCA
   02. Open the PKI database if it is not already (File ≫ Open DataBase), enter password
   03. Click on the Certificates tab, right click on your Intermediate CA certificate
   04. Select New
   05. On the Source tab, make sure Use this Certificate for signing is selected
   06. Verify your Intermediate CA certificate is selected from the drop down
   07. Click the Subject tab
   08. Complete the Distinguished Name section
         internalName: ctr.i12bretro.local
         countryName: US
         stateOrProvinceName: Virginia
         localityName: Northern
         organizationName: i12bretro
         organizationUnitName: i12bretro Certificate Authority
         commonName: ctr.i12bretro.local
   09. Click the Generate a New Key button
   10. Enter a name and set the key size to at least 2048
   11. Click Create
   12. Click on the Extensions tab
   13. Select End Entity from the type list
   14. Click Edit next to Subject Alternative Name
   15. Add any DNS or IP addresses that the certificate will identify
   16. Update the validity dates to fit your needs
   17. Click the Key Usage tab
   18. Under Key Usage select Digital Signature, Key Encipherment
   19. Under Extended Key Usage select Web Server and Web Client Authentication
   20. Click the Netscape tab
   21. Select SSL Server
   22. Click OK to create the certificate
 
Exporting Required Files
   01. In XCA, click on the Certificates tab
   02. Right click the SSL certificate ≫ Export ≫ File
   03. Set the file name to ssl.crt verify the export format is PEM (*.crt)
   04. Click OK
   05. Click the Private Keys tab
   06. Right click the private key generated for the SSL certificate ≫ Export ≫ File
   07. Set the file name to ssl.key and verify the export format is PEM Private (*.pem)
   08. Click OK
 
Method 1: Applying SSL Certificates to Portainer Web UI
   01. If the Portainer container wasn't setup to listen on 9443, connect to the Docker host and run the following commands
         # list running containers to find the name of the portainer container
         docker ps
         # stop the running portainer container
         docker stop portainer
         # remove the running portainer container
         docker rm portainer --force
         # recreate the portainer container with port 9443
         # modify as needed
         docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v ~/docker/portainer:/data portainer/portainer-ce
   02. Open a web browser and navigate to http://DNSorIP:9000
   03. Log into Portainer
   04. Click Settings in the left navigation
   05. Scroll to the SSL certificate section
   06. Click Select file under Upload X.509 certificate ≫ Browse to and select the ssl.crt file created earlier
   07. Click Select file under Upload a private key ≫ Browse to and select the ssl.key file created earlier
   08. Click the Apply Changes button
   09. Update the browser URL to https://DNSorIP:9443
   10. Welcome to Portainer running via SSL
 
Method 2: Applying SSL Certificates to Portainer CLI
   01. Download WinSCP  winscp.net/eng/downloads.php
   02. Extract WinSCP and run the executable
   03. Connect to the Portainer host IP address via WinSCP
   04. Copy the exported .pem files to the Portainer host
   05. Connect to the Docker host and run the following commands
         # list running containers to find the name of the portainer container
         docker ps
         # stop the running portainer container
         docker stop portainer
         # remove the running portainer container
         docker rm portainer --force
         # recreate the portainer container with ssl enabled
         # modify as needed
         docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v ~/docker/portainer:/data portainer/portainer-ce --ssl --sslcert /data/ssl.crt --sslkey /data/ssl.key
   06. Open a web browser and navigate to https://DNSorIP:9443
   07. Welcome to Portainer running via SSL
 
Further Reading:  documentation.portainer.io/v2.0/deploy/ssl
 


### Connect with me and others ###
★ Discord: discord.com/invite/EzenvmSHW8
★ Reddit: reddit.com/r/i12bretro
★ Twitter: twitter.com/i12bretro
Create and Apply SSL Certificates for PortainerIn-Place Upgrade Proxmox VE from 7 to 8Create a Secure Web Based Password Vault with Keepass WebMonitor Docker Container Resource Usage with cAdvisorRun HomeDash - Server MonitorDashboard - on LinuxInstall MeshCentral - Remote Management Site - on LinuxInstall SolidInvoice - Open Source Invoicing Software - on WindowsRunning a Windows Server 2025 VM in Proxmox VERunning an EndeavourOS VM in Proxmox VERun Lychee - Photo Management System - in DockerRun miniPaint - Browser Based Image Editor - in DockerInstall AdGuard Home - Cross Platform Pi Hole Alternative - on Raspberry Pi 4
i12bretro |

Create and Apply SSL Certificates for Portainer

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER