[systemd-devel] os-release: extension to expose host's version variables to containers

Simon McVittie smcv at collabora.com
Wed May 6 17:11:32 UTC 2020


On Wed, 06 May 2020 at 16:39:39 +0200, Lennart Poettering wrote:
> On Do, 16.04.20 16:56, Simon McVittie (smcv at collabora.com) wrote:
> > /run/host seems like a reasonable convention to encourage for
> > container/host systems that want this, since it doesn't require
> > inventing a new top-level directory.
> 
> I am not opposed adding something similar to nspawn, using the same
> paths. Only issue I see: docker doesn't acknowledge the existance of
> /run inside the container iirc, i.e. doesn't pre-mount it, hence
> passing data in via some subdir in /run is weird...

I suspect Docker itself probably isn't going to implement this interface,
because it doesn't generally acknowledge the existence of non-Docker
container frameworks, and sharing information from the host with the
container is pretty much the opposite of its philosophy in any case.

If *users of Docker* want to implement this interface, they can do so
with something like

    docker run \
    --mount type=tmpfs,tmpfs-mode=0755 \
    --mount type=bind,src=/etc/os-release,dst=/run/host/etc/os-release,ro \
    ...

in much the same way they can implement the "/run is a tmpfs"
interface, or the various desirable properties listed in
<https://systemd.io/CONTAINER_INTERFACE/>, by giving Docker suitable
options.

They'd have to pass similar options to Docker to get /host (which was the
original suggestion in this thread), so the conventional directory might
as well be one that doesn't need to invent new top-level directories?

    smcv


More information about the systemd-devel mailing list