Provide a Docker Image with Certbot and Azure DNS Plugin Installed from https://github.com/terrycain/certbot-dns-azure
A Dockerfile is a script that contains all the instructions needed to build a Docker container image. Below are the steps to build and run a Docker container based on a Dockerfile.
-
Clone the repository containing the Dockerfile to your local machine.
-
Change into the directory containing the Dockerfile.
-
Run the following command to build the Docker image:
docker build -t certbot-azuredns -f Dockerfile .
-
Once the image is built, you can run a Docker container based on the image using the following command:
docker run -it --rm --name certbot-azure-dns \ -v /etc/letsencrypt/:/etc/letsencrypt/ \ certbot-azuredns \ certbot certonly \ --authenticator dns-azure \ --preferred-challenges dns \ --agree-tos \ --email '[email protected]' \ --noninteractive \ --dns-azure-config /etc/letsencrypt/clouddns/azure.ini \ --domains example.com \ --domains '*.example.com'
-
And the contents of the
azure.ini
is as per the service principal example with 400 permission.dns_azure_sp_client_id = AAA... dns_azure_sp_client_secret = BBB... dns_azure_tenant_id = CCC... dns_azure_environment = "AzurePublicCloud" dns_azure_zone1 = example.com:/subscriptions/DDD.../resourceGroups/rg-dns001
-
Clone the repository containing the Dockerfile to your local machine.
-
Change into the directory containing the Dockerfile.
-
Using the docker compose file below you can the workload
version: '3.7' services: certbot-azure-dns-1: build: context: . dockerfile: Dockerfile container_name: certbot-azure-dns-1 command: - certbot - certonly - "[email protected]" - "--authenticator=dns-azure" - "--preferred-challenges=dns" - "--agree-tos" - "--noninteractive" - "--dns-azure-config=/secret/azure.ini" - "--domains=example.org" - "--domains=*.example.org" volumes: - "./letsencrypt:/etc/letsencrypt" - "./secret:/secret:ro"
-
And the contents of the
azure.ini
is as per the service principal example with 400 permission in the./secret
local directory.dns_azure_sp_client_id = AAA... dns_azure_sp_client_secret = BBB... dns_azure_tenant_id = CCC... dns_azure_environment = "AzurePublicCloud" dns_azure_zone1 = example.com:/subscriptions/DDD.../resourceGroups/rg-dns001