pid1

Do signal handling and orphan reaping for Unix PID1 init processes

https://github.com/fpco/pid1#readme

Version on this page:0.1.0.1@rev:1
LTS Haskell 22.13:0.1.3.1
Stackage Nightly 2024-03-14:0.1.3.1
Latest on Hackage:0.1.3.1

See all snapshots pid1 appears in

MIT licensed by Michael Snoyman
Maintained by [email protected]
This version can be pinned in stack with:pid1-0.1.0.1@sha256:f3213f1c04a1daa726ee2f6ceda69d843b80f4726759ef2fe2e23c4f34342746,1331

Module documentation for 0.1.0.1

Depends on 4 packages(full list with versions):
Used by 1 package in lts-8.5(full list with versions):

pid1

Build Status

Do signal handling and orphan reaping for Unix PID1 init processes.

This provides a Haskell library, and an executable based on that library, for initializing signal handlers, spawning and child process, and reaping orphan processes. These are the responsibilities that must be fulfilled by the initial process in a Unix system, and in particular comes up when running Docker containers.

This library/executable will automatically detect if it is run as some process besides PID1 and, if so, use a straightforward exec system call instead.

NOTE This package is decidedly not portable, and will not work on Windows. If you have a use case where you think it makes sense to run on Windows, I’d be interested in hearing about it.

For a discussion on why this is useful, see this repo.

Usage

The recommended use case for this executable is to embed it in a Docker image. Assuming you’ve placed it at /sbin/pid1, the two commonly recommended usages are:

  1. Override the entrypoint, either via ENTRYPOINT in your Dockerfile or --entrypoint on the command line.

    docker run --rm --entrypoint /sbin/pid1 fpco/pid1 ps
    
  2. Add /sbin/pid1 to the beginning of your command.

    docker run --rm --entrypoint /usr/bin/env fpco/pid1 /sbin/pid1 ps
    

Changes

0.1.0.1

  • Turn off all RTS options

0.1.0.0

  • Initial release