This is a Docker image designed for development purposes. It automatically generates SSL certificates for your local projects using node-forge. This setup is optimized for use with Traefik and serves as an alternative to Let's Encrypt, which does not support local domains such as .test
, .local
, .docker
, etc.
The image: ghcr.io/prvious/ssl
services:
traefik:
# Your Traefik configurations here...
command:
- '--providers.file.directory=/etc/traefik/conf'
- '--providers.file.watch=true'
# additional commands...
volumes:
- './dynamic:/etc/traefik'
ssl:
image: ghcr.io/prvious/ssl
volumes:
- './dynamic/certs:/app/files/certs' # Location for generated certificates
- './dynamic/ca:/app/files/ca' # Directory for rootCA files used to sign certificates
- './dynamic/conf/tls.yml:/app/files/traefik/tls.yml' # Traefik configuration for certificates
environment:
- CHECK_INTERVAL=10000
- CERT_DIR=/etc/traefik/certs/ # !!!REQUIRED!!! Path where certificates are mounted in the Traefik container
If you want to generate SSL certificates for a specific service or container, even if it resides in another folder or project, you can still use the prvious/ssl container. Simply ensure that the appropriate directories are mounted and the prvious.ssl.domains
and prvious.ssl.enable=true
label is configured correctly for the target service.
prvious.ssl.enable=true
prvious.ssl.domains=example.test,*.example.test
myservice:
image: your-service-image
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.myservice.rule=Host(`myservice.test`)'
- 'traefik.http.routers.myservice.entrypoints=https'
- 'traefik.http.routers.myservice.tls=true'
- 'prvious.ssl.domains=myservice.test,*.myservice.test'
To access the generated files, mount the /app/files/
directory. Within this directory:
/app/files/ca
: ContainsrootCA.pem
androotCA-key.pem
. These are automatically generated, but if you already have root certificates, mount them here./app/files/certs
: Contains all generated certificates./app/files/traefik
: Contains the generatedtls.yml
file for Traefik configuration.
Since the prvious/ssl image doesn’t know where the certificates will be mounted in Traefik, you MUST provide the CERT_DIR
variable. This variable is used to construct the full path when generating the tls.yml
file, ensuring Traefik can locate and load the certificates.
To have your system automatically trust the generated certificates, you'll need install the rootCA on your local machine.
For MacOS, you can do that through KeyChain Access
For Windows and Linux, You can use google and chatgpt to help with that. I am not familiar with those operating systems