17

I own a domain name with cloudflare nameservers. I've set up an Azure Container Instance with a running container hosted in Docker-Hub container registry. When i created the container instance i specified dns-name-label in azure's namespace, but i want to point my custom domain to this running container instead of the azure's one.

I've searching in Azure Docs for a way to point my custom domain name to this running container in ACI, but i didn't found any information about this configuration in Azure Container Instances. I did found some information regarding custom domains for blob storages, or cloud services, but none of those applied to ACI, as the custom domain setting doesn't appear in my ACI dashboard, neither in Azure CLI help commands.

Any information will be appreciated. I hope there is a solution to this that doesn't involve switching my NS to Azure's as cloudlflare is working just fine.

Vichoko
  • 353
  • 1
  • 2
  • 14

3 Answers3

13

As for as I know, ACI exposes the DNS name using a dns-name-label in azure's namespace. The FQDN like customlabel.azureregion.azurecontainer.io. is provided by Azure DNS service. Unfortunately, there is no way to directly set the custom domain for ACI, but you could create a CNAME record in your DNS provider to redirect your subdomain like www.example.com to this FQDN. If so, you can access your ACI via subdomain www.example.com.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • 1
    Thank you for your answer, sadly this cname approach didn't work out. I think there is something wrong with the Cloudlflare's SSL certificate and the CNAME redirection because i get timeout_error. I'm still trying to figure this out but my domain name isn't pointing to the FQDN. Also when i deactivate the SSL in Cloudlfare settings, i get too_many_redirects error in the domain. Also i'm a bit confused as what's the difference between an intern custom domain set-up and a single CNAME record set-up in my NS, why would azure make a configuration to this if a CNAME record would be enough. – Vichoko Jun 05 '19 at 18:51
  • 1
    Well today i re-enabled SSL in CloudFlare and the CNAME record now it's working properly. Everything is good now. Thank you for your answer. I still wonder what's the difference between the CNAME record setup and the intern Azure's custom domain setting in Azure's panel. – Vichoko Jun 05 '19 at 22:33
  • 2
    CNAME record setup allows you to redirect traffic to Azure provided DNS name. Since CNAME record is hosting in your DNS provider that you can fully control it. Whereas the azure provided FQDN is provided by Azure DNS provider, you only could control `customlabel` not the DNS suffix `.azureregion.azurecontainer.io` – Nancy Jun 06 '19 at 02:56
  • 1
    @LucaPerico it's better to raise a new question for your specific issue instead of sending comments and downvote this reply. My reply is to provide an answer to this question. – Nancy Aug 05 '20 at 08:02
  • 1
    @LucaPerico, My reply could solve the op's question. In your specific issue, it looks like an SSL cert issue on your side. When you use a custom domain, do you bind custom SSL cert for that custom domain? Otherwise, you will get an HTTPS access error. You should access HTTP with a custom domain. See more details about adding SSL in ACI APP [here](https://stackoverflow.com/questions/60958057/how-to-add-ssl-to-azure-container-instance-app) – Nancy Aug 06 '20 at 05:40
0

You may consider creating a web app for the container. Then you can create a custom domain for the web app.

-1

cname won`t work since docker sees that the ssl cert is from *.azurecr.io and not example.expemple.com and then proceeds to do nothing. it also doenst work with cloudflare ssl edit: i just did more research and i found something very very promising https://github.com/Azure/acr/tree/main/docs/custom-domain

cheers, Zakaria

  • 6
    Links to external resources are encouraged, but please [add context around the link](https://meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. [Answers that are little more than a link may be deleted](https://stackoverflow.com/help/deleted-answers) – Sabito stands with Ukraine Dec 13 '20 at 03:05
  • Note for other reviewers, I haven't flagged this one. – Sabito stands with Ukraine Dec 13 '20 at 03:06
  • 2
    The link you posted is for ACR, not ACI. – Ben Davis Dec 22 '20 at 23:01
  • This is not true. I managed to achieve what I asked for with the accepted solution. – Vichoko Oct 21 '21 at 15:36