// the find
ahmetb/go-dexec
It's like Go os/exec package but for Docker. What if you could exec programs remotely with the same interface as os/exec?
dexec runs commands inside Docker containers through an API that mirrors Go's os/exec, so a program can call Command, Output and the usual stdin/stdout plumbing against a container instead of the local machine. It is aimed at developers who want to isolate shell-outs or send CPU-heavy work to remote Docker engines without rewriting their call sites.
- The interface does match os/exec: Command, Output, stdin/stdout handling, and an ExitError type in exiterror.go. The four-line migration in the README is believable.
- The examples cover the awkward cases (stdin/stdout streaming, pipes between processes, exit codes), not just hello-world, which is where wrappers like this usually break.
- The container source is an explicit argument (dexec.ByCreatingContainer(...)) rather than hidden state, so the call site shows where the container comes from.
- The codebase is small, with a few files at the root and unit tests in cmd_test.go and type_test.go, so it can be read in one sitting before you adopt it.
- The README example imports github.com/fsouza/go-dockerclient, a third-party client with little recent activity compared with the official Docker SDK. Copying the example pulls in that older dependency.
- The last push was April 2024. Nothing in the repo shows it has been tested against current Docker Engine releases or recent Go versions, and adopters inherit that gap.
- The README import path (github.com/ahmetalpbalkan/dexec) does not match the repository it is listed under (ahmetb/go-dexec). Check the module path in go.mod before pasting the example.
- The pitch leans on security and resource isolation, but driving the engine means access to the Docker socket, which is effectively root on the host. The README does not address that trust boundary, and it matters for any remote-engine setup.