Skip to content

DNS is not configured during provisioning #1426

@bas-de-laine

Description

@bas-de-laine

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: 0cbf719

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)
  • 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
  1. put the template in ~/.colima/_templates/default.yaml
  2. create the vm COLIMA_PROFILE=default colima start --template

Expected behaviour

I expect DNS to work when provisioning scripts run.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions