terraform-provider-docker icon indicating copy to clipboard operation
terraform-provider-docker copied to clipboard

mDNS (registry) names cannot currently be used on mac with the official binary (eg: consider enabling CGO)

Open dubo-dubon-duponey opened this issue 4 years ago • 9 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and docker Provider) Version

Terraform v0.13.5

Docker provider 2.9.0

Problem description

The official mac binary is apparently cross-compiled from linux, and explicitly disables CGO (https://github.com/kreuzwerker/terraform-provider-docker/blob/master/scripts/compile.sh#L16)

There are many issues with macOS and the go resolver (one of them being: https://github.com/golang/go/issues/12524 )

This is mostly a problem when using mDNS.

A good example (which is my exact problem) is that my local registry lives on registry.local (and this name is broadcasted using mDNS).

Generally, IMHO, CGO should be enabled on mac. For example, the brew formula for terraform itself does enable CGO.

Expected Behaviour

Docker image located on an mDNS registry should work just fine.

Actual Behaviour

Does not work.

Go native resolver just faceplants:

Error: Got error when attempting to fetch image version from registry: Error during registry request: Get "https://registry.local/v2/dubodubonduponey/homekit-alsa/manifests/latest": dial tcp: lookup registry.local on 10.0.4.127:53: no such host

Important factoids

I'm not sure whether a similar problem would exist on linux (I suspect so). eg: assuming you have avahi installed, I'm not sure the go resolver would pick that up.

Steps to Reproduce

  1. setup a local registry
  2. broadcast "registry.local" over mDNS
  3. verify curl https://registry.local/v2 works fine
  4. this does not work with the provider

dubo-dubon-duponey avatar Jan 06 '21 02:01 dubo-dubon-duponey

I thought I would just confirm that I'm running the provider built from 2.9.0 with CGO_ENABLED=1 and that it (obviously) work as it should as far as mDNS is concerned.

dubo-dubon-duponey avatar Jan 06 '21 02:01 dubo-dubon-duponey

Thanks for pointing out. I guess we could easily fix this by passing the CGO_ENABLED=1 to goreleaser

mavogel avatar Jan 06 '21 08:01 mavogel

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Mar 29 '21 10:03 github-actions[bot]

Still an issue - should be reopened.

dubo-dubon-duponey avatar Apr 06 '21 17:04 dubo-dubon-duponey

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Jun 06 '21 10:06 github-actions[bot]

Still an issue, bot.

dubo-dubon-duponey avatar Jun 07 '21 22:06 dubo-dubon-duponey

@dubo-dubon-duponey I know it has been a while, sorry for that. Before I get into trying to reproduce that problem: I assume it is still an issue?

Junkern avatar Jul 11 '22 14:07 Junkern

@AntonioMeireles and @mg6 you both liked the initial bug report. Can you confirm that this is still an issue? Otherwise I will close this ticket :)

Junkern avatar Sep 01 '22 13:09 Junkern

Hi. I've tried a different approach instead (#113) but to no success so far.

mg6 avatar Sep 05 '22 09:09 mg6