k3d-io / k3d

Little helper to run CNCF's k3s in Docker
https://k3d.io/
MIT License
5.47k stars 462 forks source link

[BUG] lookup k3d-registry.localhost on `8.8.8.8:53`: no such host (on Ubuntu 24.04) #1518

Open khoaguin opened 1 month ago

khoaguin commented 1 month ago

OS: Ubuntu 24.04 (no such problem running on 22.04)

Failed to execute docker buildx build --tag k3d-registry.localhost:5800/openmined/syft-seaweedfs:dev-1727235027 --push --file seaweedfs.dockerfile --platform linux/amd64 - with the detailed command like below

ERROR: failed to solve: failed to push k3d-registry.localhost:5800/openmined/syft-seaweedfs:dev-1727235027: failed to do request: Head "https://k3d-registry.localhost:5800/v2/openmined/syft-seaweedfs/blobs/sha256:83601c6bcc7029051417d2530a55f71acab1c196fe5b3a9e2951988e10b03c51": dial tcp: lookup k3d-registry.localhost on 8.8.8.8:53: no such host
build_images: build images: error building image k3d-registry.localhost:5800/openmined/syft-seaweedfs:dev-1727235027: error executing 'docker buildx build --tag k3d-registry.localhost:5800/openmined/syft-seaweedfs:dev-1727235027 --push --file seaweedfs.dockerfile --platform linux/amd64 -':
fatal exit status 1

My /etc/docker/daemon.json looks like below

{
  "insecure-registries": ["k3d-registry.localhost:5800"],
  "dns": ["8.8.8.8", "8.8.4.4", "1.1.1.1"]
}

Also added 127.0.0.1 k3d-registry.localhost to /etc/hosts and

nameserver 8.8.8.8
nameserver 1.1.1.1

to /etc/resolv.conf.