{"id":21470330,"url":"https://github.com/unboundedsystems/containit","last_synced_at":"2025-07-13T08:09:48.049Z","repository":{"id":97063314,"uuid":"113486456","full_name":"unboundedsystems/containit","owner":"unboundedsystems","description":"The easy button for running commands in containers! For more info on using ContainIt, check out the Unbounded Systems video Seamless CLI Tools in Docker: https://youtu.be/XSgaNMtzb7M","archived":false,"fork":false,"pushed_at":"2018-06-27T13:57:53.000Z","size":13,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T00:12:29.514Z","etag":null,"topics":["cli","cohort","developer-tools","development-tools","docker","shell","tools"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unboundedsystems.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":"2017-12-07T18:43:53.000Z","updated_at":"2024-12-16T21:29:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"55ba58be-8213-47a5-9aef-d0b29d710295","html_url":"https://github.com/unboundedsystems/containit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unboundedsystems/containit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fcontainit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fcontainit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fcontainit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fcontainit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unboundedsystems","download_url":"https://codeload.github.com/unboundedsystems/containit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fcontainit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265108514,"owners_count":23712466,"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":["cli","cohort","developer-tools","development-tools","docker","shell","tools"],"created_at":"2024-11-23T09:27:03.160Z","updated_at":"2025-07-13T08:09:48.040Z","avatar_url":"https://github.com/unboundedsystems.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ContainIt\nThe easy button for running commands in containers.\n\n[ContainIt on GitHub](https://github.com/unboundedsystems/containit)\n\nContainIt is designed to make it easy to run commands in containers\ninstead of just running the native command.  This makes it much easier\nto get the right versions of build and deployment tools, work with\ndifferent command versions, and commands that don't have native\npackages on the host operating system.\n\n## QuickStart\nTo setup a directory hierarchy to use ContainIt to run commands in a container, do the following:\n```\ncd top-level\n# Clone into the directory, or create a git submodule if top-level is a repo\ngit clone https://github.com/unboundedsystems/containit\nmkdir bin\ncat \u003e bin/command-that-describes-my-container \u003c\u003cEND\n#!/usr/bin/env bash\nIMAGE=\"my-container-image:my-container-image-tag\"\nBIN_DIR=\"\\$( cd \"\\$( dirname \"\\${BASH_SOURCE[0]}\" )\" \u0026\u0026 pwd )\"\n. \"\\${BIN_DIR}/../containit/containit.sh\"\nEND\nchmod 755 bin/command-that-describes-my-container\n```\n\nNow, any command can be run inside `my-container-image` by just\ncreating a symlink `bin/command-that-describes-my-container`.  For\nexample, to run `bash` inside the container:\n```\n$ ln -s command-that-describes-my-container bin/bash\n```\nRunning `./bin/bash` will run bash inside a container created from\n`my-container-image`.  Once `bash` exits, the container will be\ndestroyed.\n\nWithin the container, top-level will be mounted at `/src`.  The only\ncaveat is that you must run any linked command from a sub-directory of\n`top-level`.  So, `../../bin/bash` from within some sub-directory tree\nof top-level will work, but `/path/to/top-level` from, say `/`, will not\nwork.\n\n## Node.js Project Example\n\nTo setup a directory called my-project to use the latest Node.js version 8 to\nrun npm, node, and anything from `$(npm bin)/...`, do the following:\n```\ncd my-project\ngit clone https://github.com/unboundedsystems/containit\nmkdir bin\ncat \u003e bin/node \u003c\u003cEND\n#!/usr/bin/env bash\nIMAGE=\"node:8\"\nCTR_ADD_PATH=\"/src/node_modules/.bin\"\nBIN_DIR=\"\\$( cd \"\\$( dirname \"\\${BASH_SOURCE[0]}\" )\" \u0026\u0026 pwd )\"\n. \"\\${BIN_DIR}/../containit/containit.sh\"\nEND\n```\n\nNow, you can initialize your package.json with the correct `npm` by doing:\n```\n$ ./bin/npm init\n```\n\nYou can start interactive node by doing:\n```\n$ ./bin/node\n```\n\nAnd so on.\n\n## Docker Arguments\n\nTo pass extra arguments to docker, use the `DOCKER_ARGS` environment variable.\nFor example, to start a node process that listens on port 80 in the container \nand expose port 8080 on the host do:\n```\nDOCKER_ARGS=\"-p 8080:80\" ./bin/node myprog.js\n```\n\n## Other Options\n\nContainIt supports a few other options to customize behavior and\nlocation of files.  See `command` in this repository for more\ndiscussion, and look at the source of `containit.sh` for more details.\n\n## Caveats\n\n`containit.sh` only works when a sourcing or linking script is run from\na directory one-level up from the command being invoked (`top-level`\nin the example above) because of how it calculates what to mount as\n`/src`.\n\n`containit.sh` attempts to handle Docker signal issues by wrapping the\ncommand that will executed inside the container with a shell script to\nforward appropriate signals to the executed command.  However, some\nbehavior will stil vary from native shell execution.  Pull requests to\naddress any shortcomings are welcome.\n\n`containit.sh` does not attempt change docker's behavior to split\nvarious output file descriptors (stdout, and stderr being the most\ncommon) to support shell redirects of these streams to different\nfiles.  Again, a pull request addressing this would be most welcome.\n\nFor example, the following will not work:\n```\n$ ./bin/node index.js 2\u003e/dev/null 1\u003emyout\n```\nIn this case stderr and stdout output will end up in `myout` because\nContainIt will add the `-t` flag to `docker run` which loses the\ndistinction between stderr and stdout.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funboundedsystems%2Fcontainit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funboundedsystems%2Fcontainit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funboundedsystems%2Fcontainit/lists"}