mkcert is a great tool for creating your own trusted Certificate Authority and certificates for any domain. Why not use mkcert in container?
The container can be run with docker run command and create a new Root CA certificate and a single certificate for our domain list.
docker run --rm -it -v "$PWD/certs:/certs" dcagatay/mkcert example.com www.example.com '*.example.com'
Note: The single quotes around '*.example.com' are necessary to prevent the shell from prematurely expanding the wildcard character.
If the domain list is not given, only Root CA certificate will be created.
docker run --rm -it -v "$PWD/certs:/certs" dcagatay/mkcert
If a Root CA certificate exists /certs/ca directory (/certs/ca/rootCA.pem and /certs/ca/rootCA-key.pem, the certificate will be created using that Root CA certificate.
The owner of the created certificates is root user by default. If you want to change the ownership of the certificates you can provide PUID and PGID environment variables to the command.
docker run --rm -it -e "PUID=$(id -u)" -e "PGID=$(id -g)" -v "$PWD/certs:/certs" dcagatay/mkcert example.com www.example.com '*.example.com'
docker buildx build -t dcagatay/mkcert:latest .
v1.4.4;
/certs/ca from /certs, If you were using a previous version you need to move your rootCA.pem and rootCA-key.pem files under /certs/ca.UID and GID, are renamed to PUID and PUID.Content type
Image
Digest
sha256:6767c4455…
Size
7.4 MB
Last updated
over 1 year ago
docker pull dcagatay/mkcert