On Tue, Aug 23, 2016 at 8:26 AM, Christian Kniep <ckn...@gaikai.com> wrote:
> Hey Rich,
>
> nice idea, but unfortunately this provides the hostname of the container
> itself.
>

As it should.  /etc/hostname inside a container should contain the
hostname of the container.  It shouldn't actually be possible to
determine the hostname of the host from inside a container, or even
that there is a host outside the container.

You could still bind-mount it into the container if you wanted to in
order to leak this information into the container.  That is up to you,
but I would suggest that openrc should not by default expose host
information into the container.

Symlinking /proc into /etc/hostname is still useful because it not
only handles container hostnames (keep in mind that two containers
could share the same /etc), but it also covers cases where the
hostname changes, and it doesn't require writing to etc (which in
general shouldn't be used to store state).

The people who are saying /etc/hostname shouldn't really exist are
completely right.  However, if for whatever reason we did want to
provide it for compatibility (just like mtab), then a symlink to /proc
at least ensures it returns the same answer as the system call.

--
Rich

Reply via email to