github.com/lalkh/containerd@v1.4.3/docs/stream_processors.md (about) 1 # Stream Processors 2 3 ## Processor API 4 5 Processors are a binary API that works off of content streams. 6 7 The incoming content stream will be provided to the binary via `STDIN` 8 and the stream processor is expected to output the processed stream on 9 `STDOUT`. If errors are encountered, errors MUST be returned via `STDERR` 10 with a non-zero exit status. 11 12 Additional information can be provided to stream processors via a payload. 13 Payloads are marshaled as `protobuf.Any` types and can wrap any type of 14 serialized data structure. 15 16 On Unix systems, the payload, if available, is provided on `fd 3` for the process. 17 18 On Windows systems, the payload, if available, is provided via a named pipe with the 19 pipe's path set as the value of the environment variable `STREAM_PROCESSOR_PIPE`. 20 21 ## Configuration 22 23 To configure stream processors for containerd, entries in the config file need to be made. 24 The `stream_processors` field is a map so that users can chain together multiple processors 25 to mutate content streams. 26 27 Processor Fields: 28 29 * Key - ID of the processor, used for passing a specific payload to the processor. 30 * `accepts` - Accepted media-types for the processor that it can handle. 31 * `returns` - The media-type that the processor returns. 32 * `path` - Path to the processor binary. 33 * `args` - Arguments passed to the processor binary. 34 35 ```toml 36 [stream_processors] 37 [stream_processors."io.containerd.processor.v1.pigz"] 38 accepts = ["application/vnd.docker.image.rootfs.diff.tar.gzip"] 39 returns = "application/vnd.oci.image.layer.v1.tar" 40 path = "unpigz" 41 args = ["-d", "-c"] 42 ```