abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
19.7k stars 397 forks source link

Unable to resolve hosts in /etc/hosts after upgrade #1200

Open datocal opened 5 days ago

datocal commented 5 days ago

Description

In Colima version 0.6.8 a container could resolve hosts defined in the host /etc/hosts

After upgrading to 0.8.0 this behaviour disappears. I'm not sure from which version this changes.

colima delete did not resolve the issue

Version

colima version 0.8.0 git commit: 9c08cff339f087c0600d9d56af7b5fbcfe02e287

runtime: docker arch: x86_64 client: v24.0.6 server: v27.3.1 limactl version 1.0.1 qemu-img version 9.1.1 Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

Operating System

Output of colima status

INFO[0000] colima is running using QEMU INFO[0000] arch: x86_64 INFO[0000] runtime: docker INFO[0000] mountType: 9p INFO[0000] socket: unix:///Users/david.tourino/.colima/default/docker.sock

Reproduction Steps

  1. Add a host on /etc/hosts like 127.0.0.1 tests-hosts.test
  2. Start colima with colima start
  3. Run a curl from a container docker run alpine/curl tests-hosts.test
  4. Output says it can't resolve host % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: tests-hosts.test

Expected behaviour

Host is resolved, like in previous versions

Additional context

The Macbook is the M1 PRO, several colleagues face the same issue.

abiosoft commented 5 days ago

Thanks for reporting.

abiosoft commented 5 days ago

In the meantime, you can start colima with --dns-host flag.

colima start --dns-host tests-hosts.test=127.0.0.1
sylvainmouquet commented 5 days ago

The network is broken with version 0.8

sudo apt-get update
Ign:1 https://download.docker.com/linux/ubuntu noble InRelease         
Ign:2 http://ports.ubuntu.com/ubuntu-ports noble InRelease             
Ign:3 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease     
Ign:1 https://download.docker.com/linux/ubuntu noble InRelease
Ign:4 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
Ign:5 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
Ign:1 https://download.docker.com/linux/ubuntu noble InRelease
Ign:2 http://ports.ubuntu.com/ubuntu-ports noble InRelease
Ign:3 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
Ign:4 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
Err:1 https://download.docker.com/linux/ubuntu noble InRelease
  Could not resolve 'download.docker.com'
Ign:5 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
Ign:2 http://ports.ubuntu.com/ubuntu-ports noble InRelease
Ign:3 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
Ign:4 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
Ign:5 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
Err:2 http://ports.ubuntu.com/ubuntu-ports noble InRelease
  Could not resolve 'ports.ubuntu.com'
Err:3 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
  Could not resolve 'ports.ubuntu.com'
Err:4 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
  Could not resolve 'ports.ubuntu.com'
Err:5 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
  Could not resolve 'ports.ubuntu.com'
Reading package lists... Done
W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/noble/InRelease  Could not resolve 'download.docker.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/noble/InRelease  Could not resolve 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/noble-updates/InRelease  Could not resolve 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/noble-backports/InRelease  Could not resolve 'ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/noble-security/InRelease  Could not resolve 'ports.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
sylvainmouquet commented 5 days ago

and it works with colima start --network-address -t vz -c 3 -m 8 --vz-rosetta --verbose -f

aegixx commented 4 days ago

I was able to override by specifying DNS servers using --dns 1.1.1.1 --dns 1.0.0.1. When I looked at the /etc/resolv.conf, it specified a DNS server that was part of a network I logged into a couple days ago. Hopefully that helps someone track down the potential issue?