kreuzwerker / terraform-provider-docker

Terraform Docker provider
Mozilla Public License 2.0
635 stars 189 forks source link

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

Open dubo-dubon-duponey opened 3 years ago

dubo-dubon-duponey commented 3 years ago

Community Note

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 commented 3 years ago

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.

mavogel commented 3 years ago

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

github-actions[bot] commented 3 years ago

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.

dubo-dubon-duponey commented 3 years ago

Still an issue - should be reopened.

github-actions[bot] commented 3 years ago

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.

dubo-dubon-duponey commented 3 years ago

Still an issue, bot.

Junkern commented 2 years ago

@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 commented 2 years ago

@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 :)

mg6 commented 2 years ago

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