The pid1 package

[Tags:library, mit, program]

Please see README.md or view Haddocks at https://www.stackage.org/package/pid1


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1
Change log ChangeLog.md
Dependencies base (>=4.6 && <5), pid1, process (>=1.2), unix [details]
License MIT
Copyright 2016 Michael Snoyman
Author Michael Snoyman
Maintainer michael@snoyman.com
Stability Unknown
Category System
Home page https://github.com/fpco/pid1#readme
Source repository head: git clone https://github.com/fpco/pid1
Uploaded Wed Nov 23 06:17:14 UTC 2016 by MichaelSnoyman
Updated Wed Nov 23 08:46:30 UTC 2016 by HerbertValerioRiedel to revision 1
Distributions Arch:0.1.0.1, LTSHaskell:0.1.0.1, NixOS:0.1.0.1, Stackage:0.1.0.1, Tumbleweed:0.1.0.1
Downloads 79 total (38 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-11-23 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for pid1

Readme for pid1-0.1.0.1

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