NewsCrawler.org

dtshim: run host commands from inside Docker containers (Rust)

dtshim lets a program inside a Docker container run commands on the host machine. The client in the container sends the call to a daemon[1] on the host, which returns the output and exit code, so for the calling program it looks like running an ordinary command. The source gives the example of autonomous agent development, where an agent works in an isolated container and may lack access to a corporate network or to tools available only on the host.

The package has two programs. dtshimd runs on the host, accepts requests over TCP or a Unix socket[2], and starts processes. dtshim runs in the container and passes the command name, arguments, environment variables and standard input to the daemon. A symbolic link[3] to dtshim named git makes git --version in the container run git on the host. TCP is the default transport, and the daemon listens on 127.0.0.1 at ports 20001–65535 and prints its address to stdout. The daemon has a limit of 128 sessions and allows 10 seconds for the first complete request after a connection is accepted.

An optional policy file restricts commands. Without one, commands are not limited. With one, the executable field sets the absolute path of a host program, and the allow list restricts arguments. Policy changes take effect after the daemon restarts. The Dockerfile example copies the client from the ghcr.io/korableg/dtshim:latest image, which contains only a static Linux client for linux/amd64 and linux/arm64.

Read the original github.comDiscussion

Sources

Published: First seen: Читать по-русски

Open as a page