Git Product home page Git Product logo

Comments (2)

vcaputo avatar vcaputo commented on June 16, 2024

systemd-nspawn recognizes the LISTEN_FDS environment variable and propagates it down to the container intact.

The interesting part is what systemd does with the inherited file descriptors in stage1 post-nspawn, LISTEN_FDS is not utilized. At an early stage systemd will try match all open files found in /proc/self/fd to available unit files. If any of the fds match socket units then those socket units will utilize the inherited fds rather than attempting to bind again. Emphasis is placed on early because in our minimal rocket rootfs where we only have a default.target, the appropriate place to integrate sockets.target is not obvious. Adding Requires/After sockets.target to default.target in ineffective.

This is because there are a limited set of units integrated at the pre-distribute-open-fds phase of startup:
-.mount
local-fs.target
proc-sys-kernel-random-boot_id.mount
umount.target
system.slice
-.slice
shutdown.target
systemd-journald.socket
local-fs-pre.target

Note default.target, basic.target, and sysinit.target are not included as one might expect. It is in the transition out of this phase that default.target becomes loaded, but that is after the open fd distribution has occurred.

In order to get socket activation working with the current minimal rocket rootfs one can add a local-fs.target like so:
[Unit]
Description=Hook into early systemd for socket activation
DefaultDependencies=false
Requires=sockets.target

Then add a sockets.target and simply link the appropriate .socket files into the sockets.target.wants directory.

from rkt.

davidstrauss avatar davidstrauss commented on June 16, 2024

As of v0.8, this is now possible and documented: #1211

from rkt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.