-
Notifications
You must be signed in to change notification settings - Fork 220
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
Don't set entire FQDN hostname to just container name #969
Comments
Here's an example of how any application that actually wants to programmatically get the real hostname or FQDN will not actually get the real hostname or FQDN when run inside a toolbox container. Python example:
It's not hard to imagine applications where this is not the desired behavior. For instance, a web application that reports to the users how to connect to the machine via browser URL etc... |
FYI update on what Luca (distrobox) and I (cnest) decided makes sense in 89luca89/distrobox#62 We both currently think that an approach that makes a lot of sense is to set the hostname of the container to It also has the nice property that FQDN hostname is different across different machines on the network even if they share the same container name. So two containers both named |
issue: containers#969 Setting the hostname to toolbox causes timeouts whenever anything tries to resolve the name of the machine - for example `sudo` does this. This change makes it so the FQDN is set to `${container_name}.${hostname}` as recommended in the linked issue. After this change commands can properly resolve the local FQDN.
issue: containers#969 Setting the hostname to toolbox causes timeouts whenever anything tries to resolve the name of the machine - for example `sudo` does this. This change makes it so the FQDN is set to `${container_name}.${hostname}` as recommended in the linked issue. After this change commands can properly resolve the local FQDN.
issue: containers#969 Setting the hostname to toolbox causes timeouts whenever anything tries to resolve the name of the machine - for example `sudo` does this. This change makes it so the FQDN is set to `${container_name}.${hostname}` as recommended in the linked issue. After this change commands can properly resolve the local FQDN.
issue: containers#969 Setting the hostname to toolbox causes timeouts whenever anything tries to resolve the name of the machine - for example `sudo` does this. This change makes it so the FQDN is set to `${container_name}.${hostname}` as recommended in the linked issue. After this change commands can properly resolve the local FQDN. Signed-off-by: Alex Diaz <[email protected]>
issue: containers#969 Setting the hostname to toolbox causes timeouts whenever anything tries to resolve the name of the machine - for example `sudo` does this. This change makes it so the FQDN is set to `${container_name}.${hostname}` as recommended in the linked issue. After this change commands can properly resolve the local FQDN. Signed-off-by: Alex Diaz <[email protected]>
I haven't spent too much time thinking about this, but this does sound like a sensible default to me. One problem with setting the host name through Of course, users can hack this up using their shell start-up scripts, but it will be good to come up with a less barbaric solution. :) |
Yeah, I can see this as an issue if a default container name/hostname is automatically assigned. IIRC, this is what toolbox does. That said, in my own workflow (using https://cnest.readthedocs.io), I never end up wanting to change nest container names after they are created. Nor would I want to. They have names like I create nest container images from a Dockerfile using |
Often the desire for a better hostname is conflated with the desire for better ways to visually distinguish between Toolbx containers. This issue and comments like #771 (comment) and #98 (comment) show why they aren't the same thing. Let's use this issue to improve the default hostname for Toolbx containers, and let's use #98 for better ways to visually distinguish between containers. |
Below is more or less the same issue I describe in 89luca89/distrobox#62
Describe the bug
The container created by
toolbx
is setting the hostname in the container totoolbox
. For example /etc/hostname is a value that is not actually the DNS name of any host on any network. Seeman hostname
for all the assumptions made about and effects of setting /etc/hostname.Expected behaviour
The FQDN hostname in the container should contain the FQDN of the host
be the same hostname as the host because they are sharing the network.In light of the resolution of 89luca89/distrobox#62, I'm striking out the suggestions I made initially. A summary conclusion is below at #969 (comment).
On Debian there is a precedence for indicating the chroot in the command line prompt (chroot being a precursor to containers). To my knowledge there isn't an equivalent on Fedora based distros. Not knowing of an alternative I started usingosvirtalias
in cnest.I describe the situation in more detail here:https://github.com/castedo/cnest/tree/master/prompt
So I can suggest doing similarly and setosvirtalias
and/ordebian_chroot
to be the name of the container, and let the distro and container configuration determine the command line prompts however they are supposed to. And do this without incorrectly repurposing the hostname for a purpose other than what hostname is supposed to mean.If you come across an alternative toosvirtalias
please let me know. I don't want to start a precedent that is non-standard, but I do want to start a precedent other thandebian_chroot
. If it catches on, Debian distros probably want to use a name without chroot in it anyway.The text was updated successfully, but these errors were encountered: