Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostname not populated in /etc/hosts for containerd tasks #103

Open
zh4n7wm opened this issue Jul 14, 2021 · 0 comments
Open

hostname not populated in /etc/hosts for containerd tasks #103

zh4n7wm opened this issue Jul 14, 2021 · 0 comments
Assignees
Labels
bug Something isn't working work-in-progress

Comments

@zh4n7wm
Copy link

zh4n7wm commented Jul 14, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working work-in-progress
Projects
None yet
Development

No branches or pull requests

2 participants