…and more importantly, where is that setting stored so I can turn it on for all of them?

I realize this varies according to OS, so I’m specifically asking about my Turnkey Nextcloud and Turnkey Mediaserver containers, which are based on Debian Linux. It’s perhaps worth noting that my Turnkey Syncthing container, which uses the same base OS, does register its hostname with my DHCP server. I’ve gone digging around in /etc/ etc. in each of the containers, but so far I haven’t found any configuration differences that would explain the difference in behavior. (Also, if it matters, my DHCP server is the one included with OpenWRT and running on my router.)

By the way, I’m aware that the best answer might be “you have an X/Y problem and you really ought to use static IPs and/or setup a reverse proxy,” but I haven’t gotten to that point yet. Besides, I still want to satisfy my curiosity about DHCP and hostnames regardless.

EDIT: to be clear, this post is about LXC containers running directly in Proxmox, NOT Docker.

  • CameronDev@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    The hostname resolution might be being done via mdns (https://en.m.wikipedia.org/wiki/Multicast_DNS). That is seperate to your actual DNS server, and I don’t think you can centrally disable it. You would have to disable Avahi/ZeroConf/Bonjour on your computer to prevent resolution, or find a way to prevent the containers registering themselves?

    https://linux.die.net/man/1/avahi-browse - might help you determine if it’s being registered via mdns.

  • Morethanevil@lmy.mymte.de
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    2
    ·
    1 year ago

    You can pass hostnames in docker compose easily with

    hostname: myhostname

    Sometimes you can use container names too

    container_name: myapp

    It is that easy ☺️

      • Morethanevil@lmy.mymte.de
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Okay this is easy too to set a hostname on debian or ubuntu Container:

        hostnamectl set-hostname myname

        • grue@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 year ago

          root@syncthing ~# hostnamectl status
          Failed to connect to bus: No such file or directory

          • Morethanevil@lmy.mymte.de
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            Try this

            apt-get install libpam-systemd

            Restart LXC afterwards and try again. Let me know if it works now 🐱

  • Max-P@lemmy.max-p.me
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    Where is that DHCP server? Are you sure they get actual DHCP leases?

    Typically Docker’s internal resolution is basically just injecting the hostnames in /etc/hosts, but Docker also supports macvlan and macvtap networks too which can expose a container network directly on the network.

    But I think 99% of containers just use the default bridge network. I never heard of a Docker container running a DHCP client, most containers run the app process directly and don’t do a full boot.

  • chenxiaolong@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 year ago

    I don’t have any knowledge about the specific containers, but the way this works on my Linux distro is via the:

    send host-name "(hostname)";
    

    option in dhclient.conf. Maybe you could try explicitly setting that option?

    • grue@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      That’s part of what’s confusing me: none of the containers even have an /etc/dhcp/dhclient.conf (and I don’t think it’s anywhere else either because $PATH_DHCLIENT_CONF is unset).