Roblox / nomad-driver-containerd

Nomad task driver for launching containers using containerd.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hostname not populated in /etc/hosts for containerd tasks

zh4n7wm opened this issue · comments

commented

nomad version: v1.1.2
os version: Linux archlinux 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 GNU/Linux

jobspec:

job "python" {
    datacenters = ["dc1"]
    type = "service"

    group "python" {
        count = 1

        network {
            mode = "bridge"
        }

        task "python" {
            driver = "containerd-driver"
            config {
                image = "python:3.7.11-buster"
                command = "sh"
                args = ["-c", "while true; do sleep 300; done"]
            }
        }
    }
}

after run python task, run nomad exec -task python c81d0472 bash

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# hostname
python-c81d0472-e79f-3656-debd-97afada978d1

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# cat /etc/hostname
debuerreotype

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# cat /etc/hosts
127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# hostname -I
172.26.64.3

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# hostname -i
hostname: Name or service not known

root@python-c81d0472-e79f-3656-debd-97afada978d1:/# hostname -f
hostname: Name or service not known

I think there are many issue:

  • hostname python-c81d0472-e79f-3656-debd-97afada978d1 did not in /etc/hostname
  • should add 172.26.64.3 python-c81d0472-e79f-3656-debd-97afada978d1 to /etc/hosts ?
  • hostname -i and hostname -f should work?

change task.driver to docker, it will work fine.

so, I think this is bug of containerd driver.

maybe this link is helpful: hashicorp/nomad#10766