'Fetch secrets and certificates from AzureKeyVault inside Docker container

I have a .net framework console application. Inside this application, I'm fetching secrets and certificates from keyvault using tenantId, client Id and Client Secret. Application is fetching secrets and certificates properly. Now I have containerized the application using Docker. After running the image I'm unable to fetch secrets and certificates. I'm getting below error:

" Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry. (No such host is known.) (No such host is known.) (No such
host is known.) (No such host is known.)"


Solution 1:[1]

To resolve the error, please try the following workarounds:

  • Check whether your container was setup behind an nginx reverse proxy.
  • If yes, then try removing the upstream section from the nginx reverse proxy and set proxy_pass to use docker-compose service's hostname.
  • After any change make sure to restart WSL and Docker.
  • Check if DNS is resolving the host names successfully or not, otherwise try adding the below in your docker-compose.yml file.
dns:
- 8.8.8.8
  • Try removing auto generated values by WSL in /etc/resolv.conf and add DNS like below if above doesn't work.
# [network]
# generateResolvConf = false
nameserver 8.8.8.8
  • Try restarting the WSL by running below command as an Admin:

Restart-NetAdapter -Name "vEthernet (WSL)"

  • Try installing a Docker Desktop update as a workaround.

For more in detail, please refer below links:

Getting "Name or service not known (login.microsoftonline.com:443)" regularly, but occasionally it succeeds? · Discussion #3102 · dotnet/dotnet-docker · GitHub

ssl - How to fetch Certificate from Azure Key vault to be used in docker image - Stack Overflow

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SrideviMachavarapu-MT