abiosoft / abiosoft/colima

DNS is not configured during provisioning

Ouverte
#1,426 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
30.8k
Forks
613
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Description

Since v0.9.0, when running provisioning scripts (from the templates `provisioning` section), DNS is not configured/working. At this point in time, there is no `/etc/resolv.conf` file.

Once the VM is booted, `/etc/resolv.conf` is materialized. Maybe `setupDNS` (https://github.com/abiosoft/colima/blob/main/environment/vm/lima/dns.go#L26) is called too late?

### Version

colima version 0.9.1
git commit: 0cbf719f5409ce04b9f0607b681c005d2ff7d94a

runtime: docker
arch: x86_64
client: v28.5.0
server: v28.4.0
limactl version 1.2.1
qemu-img version 10.1.0
Copyright (c) 2003-2025 Fabrice Bellard and the QEMU Project developers

### Operating System

- [ ] macOS Intel <= 13 (Ventura)
- [x] macOS Intel >= 14 (Sonoma)
- [ ] Apple Silicon <= 13 (Ventura)
- [ ] Apple Silicon >= 14 (Sonoma)
- [ ] Linux

### Output of `colima status`

INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: x86_64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] docker socket: unix:///Users/bas-de-laine/.colima/default/docker.sock
INFO[0000] containerd socket: unix:///Users/bas-de-laine/.colima/default/containerd.sock

### Reproduction Steps

1. Using the default template https://github.com/abiosoft/colima/blob/v0.9.1/embedded/defaults/colima.yaml, add a provisioning step to check whether `/etc/resolv.conf` exists and whether it is possible to resolve `github.com`:

```
provision:
- mode: system
script: |
#!/usr/bin/env bash
{
printf "Checking whether /etc/resolv.conf exists\n\n"
[ -f /etc/resolv.conf ] && printf "🟢 /etc/resolv.conf exists\n" || printf "🔴 /etc/resolv.conf is missing\n"
printf "\nCalling getent ahosts github.com\n\n"
getent ahosts github.com
} > /Users/bas-de-laine/colima_resolv_conf_is_present.txt
```
2. put the template in `~/.colima/_templates/default.yaml`
3. create the vm `COLIMA_PROFILE=default colima start --template`

### Expected behaviour

I expect DNS to work when provisioning scripts run.

### Additional context

_No response_

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

The issue points to environment/vm/lima/dns.go and the setupDNS function. Start by examining the Lima VM provisioning sequence to see when DNS is configured relative to script execution. Check the provisioning scripts in the templates. Reproduce the issue locally with the provided steps to confirm the missing /etc/resolv.conf. The fix likely involves adjusting the timing of DNS setup during VM initialization.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
docker, go, shell
Domaine
cli, devops, networking
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.