{"id":13416598,"url":"https://github.com/docker-exec/dexec","last_synced_at":"2025-03-15T00:31:10.626Z","repository":{"id":28698694,"uuid":"32219023","full_name":"docker-exec/dexec","owner":"docker-exec","description":":whale: Command line interface for running code in many languages via Docker.","archived":false,"fork":false,"pushed_at":"2021-05-13T06:04:19.000Z","size":1014,"stargazers_count":329,"open_issues_count":17,"forks_count":18,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-07-31T21:57:15.604Z","etag":null,"topics":["docker","execution","go","polyglot"],"latest_commit_sha":null,"homepage":"https://docker-exec.github.io/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docker-exec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-14T15:43:29.000Z","updated_at":"2024-07-25T00:26:23.000Z","dependencies_parsed_at":"2022-08-29T00:02:58.184Z","dependency_job_id":null,"html_url":"https://github.com/docker-exec/dexec","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-exec%2Fdexec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-exec%2Fdexec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-exec%2Fdexec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-exec%2Fdexec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docker-exec","download_url":"https://codeload.github.com/docker-exec/dexec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243667725,"owners_count":20328032,"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":["docker","execution","go","polyglot"],"created_at":"2024-07-30T21:01:01.753Z","updated_at":"2025-03-15T00:31:10.136Z","avatar_url":"https://github.com/docker-exec.png","language":"Go","readme":"# dexec ![Build Status](https://github.com/docker-exec/dexec/workflows/Unit%20Tests/badge.svg)  [ ![Download](https://api.bintray.com/packages/dexec/release/dexec/images/download.svg) ](https://bintray.com/dexec/release/dexec/_latestVersion)\n\nA command line utility for executing code in many different languages using the Docker Exec images, written in Go.\n\n![dexec demo animation](https://docker-exec.github.io/images/dexec-short-1.0.1.gif)\n\n## Installation\n\n### Using Bintray\n\nDownload the appropriate binary for your OS and architecture, then unzip or untar and move the ```dexec``` executable to where it can be found on your PATH.\n\n| OS      | 64-bit | 32-bit |\n| ------- | ------ | ------ |\n| Linux   |  [64-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_linux_amd64.tar.gz) | [32-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_linux_386.tar.gz) |\n| Mac     |  [64-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_darwin_amd64.zip) | [32-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_darwin_386.zip) |\n| Windows |  [64-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_windows_amd64.zip) | [32-bit](https://bintray.com/artifact/download/dexec/release/dexec_1.0.7_windows_386.zip) |\n\nBinaries for other distributions are available on [Bintray](https://bintray.com/dexec/release/dexec/_latestVersion).\n\n### Using Go\n\nInstall with the ```go get``` command.\n\n```sh\n$ go get github.com/docker-exec/dexec\n```\n\n### Using Homebrew\n\nIf you're on OSX you can install the latest release of ```dexec``` with brew.\n\n```sh\n$ brew install docker-exec/formula/dexec\n```\n\n## Reference\n\nThese examples use a .cpp source file, but any of the supported languages can be used instead. Arguments can be passed in any order, using any style of the acceptable switch styles described.\n\nThe application provides help and version information as follows:\n\n```sh\n$ dexec --version\n$ dexec --help\n```\n\n### Pass source files to execute\n\nMultiple source files can be passed to the compiler or interpreter as follows. The first source file's extension is used to pick the appropriate Docker Exec image, e.g. .cpp retrieves dexec/cpp from the Docker registry.\n\n```sh\n$ dexec foo.cpp\n$ dexec foo.cpp bar.cpp\n```\n\nThe sources are mounted individually using the default Docker mount permissions (rw) and can be specified by appending :ro or :rw to the source file.\n\n### Pass arguments for build\n\nFor compiled languages, arguments can be passed to the compiler.\n\n```sh\n$ dexec foo.cpp --build-arg=-std=c++11\n$ dexec foo.cpp --build-arg -std=c++11\n$ dexec foo.cpp -b -std=c++11\n```\n\n### Pass arguments for execution\n\nArguments can be passed to the executing code. Enclose arguments with single quotes to preserve whitespace.\n\n```sh\n$ dexec foo.cpp --arg=hello --arg=world --arg='hello world'\n$ dexec foo.cpp --arg hello --arg world --arg 'hello world'\n$ dexec foo.cpp -a hello -a world -a 'hello world'\n```\n\n### Specify location of source files\n\nBy default, ```dexec``` assumes the sources are in the directory from which it is being invoked from. It is possible to override the working directory by passing the ```-C``` flag.\n\n```sh\n$ dexec -C /path/to/sources foo.cpp bar.cpp\n```\n\n### Read from STDIN\n\n```dexec``` will forward your terminal's STDIN to the executing code. You can redirect from a file or use pipe:\n\n```sh\n$ dexec foo.cpp \u003cinput.txt\n```\n\n```sh\n$ curl http://input | dexec foo.cpp\n```\n\n### Include files and folders\n\nIndividual files can be mounted without being passed to the compiler, for example header files in C \u0026 C++, or input files for program execution. These can be included in the following way.\n\n```sh\n$ dexec foo.cpp --include=bar.hpp\n$ dexec foo.cpp --include bar.hpp\n$ dexec foo.cpp -i bar.hpp\n```\n\nIn addition, a program may require read and/or write access to several files on the host system. The most efficient way to achieve this is to include a directory.\n\n```sh\n$ dexec foo.cpp --include=.\n$ dexec foo.cpp --include .\n$ dexec foo.cpp -i .\n```\n\nFiles and directories are relative to either the current working directory, or the directory specified with the ```-C``` flag.\n\nAs with sources, included files and directories are mounted using the default Docker mount permissions (rw) and can be specified by appending :ro or :rw to the source file.\n\n### Override the image used by dexec\n\n```dexec``` stores a map of file extensions to Docker images and uses this to look up the right image to run for a given source file. This can be overridden in the following ways:\n\n#### Override image by name/tag\n\n```sh\n$ dexec foo.c --image=dexec/lang-cpp\n$ dexec foo.c --image dexec/lang-cpp\n$ dexec foo.c -m dexec/lang-cpp\n```\n\nThis will cause ```dexec``` to attempt to use the supplied image. If no image version is specified, \"latest\" is used.\n\n#### Override image by file extension\n\n```sh\n$ dexec foo.c --extension=cpp\n$ dexec foo.c --extension cpp\n$ dexec foo.c -e cpp\n```\n\nThis will cause ```dexec``` to attempt to lookup the image for the supplied extension in its map.\n\n### Force dexec to pull latest version of image\n\nPrimarily for debugging purposes, the --update command triggers a ```docker pull``` of the target image before executing the code.\n\n```sh\n$ dexec foo.cpp -u\n$ dexec foo.cpp --update\n```\n\n### Force dexec to remove all dexec images\n\nThe --clean command removes all versions of images matching /^dexec/lang-([^:\\s])$/. It can be combined with source files or STDIN input if you wish to remove all containers stored locally before executing.\n\n```sh\n$ dexec --clean\n```\n\n### Executable source with shebang\n\n```dexec``` can be used to make source code executable by adding a shebang that invokes it at the top of a source file.\n\nThe shebang is stripped out at execution time but the original source containing the shebang is preserved.\n\n```c++\n#!/usr/bin/env dexec\n#include \u003ciostream\u003e\nint main() {\n    std::cout \u003c\u003c \"hello world\" \u003c\u003c std::endl;\n}\n```\n\nthen\n\n```sh\n$ chmod +x foo.cpp\n$ ./foo.cpp\n```\n\n## Contributors\n\n#### [docker-exec/dexec](https://github.com/docker-exec/dexec/graphs/contributors)\n\n * [John H. Ayad](https://github.com/johnhany97)\n * [Alix Axel](https://github.com/alixaxel)\n * [kroton](https://github.com/kroton)\n * [John Albietz](https://github.com/inthecloud247)\n\n#### [docker-exec/perl](https://github.com/docker-exec/perl/graphs/contributors)\n\n * [Øyvind Skaar](https://github.com/oyvindsk)\n\n## See also\n\n* [Docker Exec GitHub Page](https://docker-exec.github.io/)\n* [Docker Exec GitHub Repositories](https://github.com/docker-exec)\n* [Docker Exec Images on Docker Hub](https://hub.docker.com/r/dexec/)\n* [dexec on Bintray](https://bintray.com/dexec/release/dexec/view)\n","funding_links":[],"categories":["Development with Docker","Dev Tools"],"sub_categories":["Wrappers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-exec%2Fdexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocker-exec%2Fdexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-exec%2Fdexec/lists"}