{"id":19029784,"url":"https://github.com/ahmetb/go-dexec","last_synced_at":"2025-04-05T07:07:36.562Z","repository":{"id":45265088,"uuid":"52940540","full_name":"ahmetb/go-dexec","owner":"ahmetb","description":"It's like Go os/exec package but for Docker. What if you could exec programs remotely with the same interface as os/exec?","archived":false,"fork":false,"pushed_at":"2024-04-29T06:07:13.000Z","size":44,"stargazers_count":431,"open_issues_count":5,"forks_count":37,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-29T06:07:52.412Z","etag":null,"topics":["containers","docker","go","rpc"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/ahmetalpbalkan/go-dexec","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmetb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-02T06:46:09.000Z","updated_at":"2025-02-17T14:49:48.000Z","dependencies_parsed_at":"2023-11-10T20:46:52.799Z","dependency_job_id":null,"html_url":"https://github.com/ahmetb/go-dexec","commit_stats":null,"previous_names":["ahmetalpbalkan/dexec","ahmetalpbalkan/go-dexec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetb%2Fgo-dexec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetb%2Fgo-dexec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetb%2Fgo-dexec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetb%2Fgo-dexec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmetb","download_url":"https://codeload.github.com/ahmetb/go-dexec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299833,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containers","docker","go","rpc"],"created_at":"2024-11-08T21:15:17.368Z","updated_at":"2025-04-05T07:07:36.545Z","avatar_url":"https://github.com/ahmetb.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# dexec [![GoDoc](https://godoc.org/github.com/ahmetalpbalkan/dexec?status.png)][godoc]\n\n\n`dexec` is a small Go library allowing you to run processes inside \nDocker containers as if you are running them locally using [`os/exec`][osexec] package.\nRead documentation at [godoc.org][godoc] or [see examples](examples).\n\nUsing `dexec`, you can do stream processing, off-load computationally\nexpensive parts of your program to a remote fleet of Docker engines.\nIts interface is [strikingly similar][godoc] to [`os/exec`][osexec].\n\n[osexec]: https://godoc.org/os/exec\n[godoc]: https://godoc.org/github.com/ahmetalpbalkan/dexec\n\n### Examples\n\nCheck out the following [examples](examples):\n\n- [Hello, world inside container →](examples/100-hello)\n- [Connect to container’s `STDIN`/`STDOUT` →](examples/200-stdin-stdout)\n- [Stream processing with pipes →](examples/300-pipes)\n- [Check exit code of a remote process →](examples/400-exit-code)\n- [Audio extraction from YouTube videos →](examples/500-video-processing)\n- [Parallel computation on Swarm →](examples/600-parallel-compute)\n\n### A Short Example \n\nIt takes only a **4-line code change** to convert a piece of code\nusing `os/exec` to use `dexec` to start running your stuff inside containers.\n\nHere is a minimal Go program that runs `echo` in a container:\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/ahmetalpbalkan/dexec\"\n\t\"github.com/fsouza/go-dockerclient\"\n)\n\nfunc main(){\n\tcl, _ := docker.NewClient(\"unix:///var/run/docker.sock\")\n\td := dexec.Docker{cl}\n\n\tm, _ := dexec.ByCreatingContainer(docker.CreateContainerOptions{\n\tConfig: \u0026docker.Config{Image: \"busybox\"}})\n\n\tcmd := d.Command(m, \"echo\", `I am running inside a container!`)\n\tb, err := cmd.Output()\n\tif err != nil { log.Fatal(err) }\n\tlog.Printf(\"%s\", b)\n}\n```\n\nOutput: `I am running inside a container!`\n\n### Use Cases\n\nThis library is intended for providing an execution model that looks and feels\nlike [`os/exec`][osexec] package.\n\nYou might want to use this library when:\n\n- You want to execute a process, but run it in a container with extra security\n  and finer control over resource usage with Docker –and change your code\n  minimally.\n\n- You want to execute a piece of work on a remote machine (or even better, a pool\n  of machines or a cluster) through Docker. Especially useful to distribute\n  computationally expensive workloads.\n\nFor such cases, this library abstracts out the details of executing the process\nin a container and gives you a cleaner interface you are already familiar with.\n\n[Check out more examples →](examples)\n\n[Read more →](https://ahmetalpbalkan.com/blog/dexec/)\n\n![Analytics](https://ga-beacon.appspot.com/UA-45321252-5/welcome-page)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetb%2Fgo-dexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmetb%2Fgo-dexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetb%2Fgo-dexec/lists"}