Menu

Post image 1
Post image 2
1 / 2
0

Sending stdin into a container using nothing but kernel primitives

DEV Community·Bjørn T. Dahl·about 1 month ago
#j9D8MYGo
Reading 0:00
15s threshold

Originally published at blog.apario.net When a containerised process needs input via stdin, delivering it from outside the container is often done in a more complex way than necessary. This article describes a lightweight, robust approach using a host-created FIFO mounted into the container, providing a simple, near-zero-overhead, atomic, scriptable, multi-source stdin channel with no extra daemons, no docker exec , and no PTY involvement. The problem Some processes use stdin as their primary input channel. When such a process runs inside a Docker container, the conventional options for sending input to it from the host are: docker exec -i container command — spawns a new process inside the container rather than reaching the existing one's stdin, introduces extra pipes and process overhead, and is unsuitable for automation when ordering or atomicity matters.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More