{"id":13539800,"url":"https://github.com/devcontainers/cli","last_synced_at":"2025-05-12T15:36:22.255Z","repository":{"id":37086496,"uuid":"486125557","full_name":"devcontainers/cli","owner":"devcontainers","description":"A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.","archived":false,"fork":false,"pushed_at":"2025-04-07T19:51:32.000Z","size":2410,"stargazers_count":1792,"open_issues_count":223,"forks_count":269,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-04-08T23:02:34.544Z","etag":null,"topics":["containers","devcontainers"],"latest_commit_sha":null,"homepage":"https://containers.dev","language":"TypeScript","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/devcontainers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-27T09:20:08.000Z","updated_at":"2025-04-08T13:47:24.000Z","dependencies_parsed_at":"2024-01-30T09:30:52.645Z","dependency_job_id":"7b900632-94ef-465d-b0c1-8563faf93e13","html_url":"https://github.com/devcontainers/cli","commit_stats":{"total_commits":389,"total_committers":25,"mean_commits":15.56,"dds":0.6709511568123394,"last_synced_commit":"e3d12b3157cc2ec74805d6764f67ad461d49ecc1"},"previous_names":[],"tags_count":101,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainers%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainers%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainers%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainers%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devcontainers","download_url":"https://codeload.github.com/devcontainers/cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250478732,"owners_count":21437225,"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","devcontainers"],"created_at":"2024-08-01T09:01:32.090Z","updated_at":"2025-04-23T17:24:29.592Z","avatar_url":"https://github.com/devcontainers.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","containers","others","Catalog"],"sub_categories":["environment"],"readme":"# Dev Container CLI\n\nThis repository holds the dev container CLI, which can take a devcontainer.json and create and configure a dev container from it.\n\n## Context\n\nA development container allows you to use a container as a full-featured development environment. It can be used to run an application, to separate tools, libraries, or runtimes needed for working with a codebase, and to aid in continuous integration and testing. Dev containers can be run locally or remotely, in a private or public cloud.\n\n![Diagram of inner and outerloop development with dev containers](/images/dev-container-stages.png)\n\nThis CLI is in active development. Current status:\n\n- [x] `devcontainer build` - Enables building/pre-building images\n- [x] `devcontainer up` - Spins up containers with `devcontainer.json` settings applied\n- [x] `devcontainer run-user-commands` - Runs lifecycle commands like `postCreateCommand`\n- [x] `devcontainer read-configuration` - Outputs current configuration for workspace\n- [x] `devcontainer exec` - Executes a command in a container with `userEnvProbe`, `remoteUser`, `remoteEnv`, and other properties applied\n- [x] `devcontainer features \u003c...\u003e` - Tools to assist in authoring and testing [Dev Container Features](https://containers.dev/implementors/features/)\n- [x] `devcontainer templates \u003c...\u003e` - Tools to assist in authoring and testing [Dev Container Templates](https://containers.dev/implementors/templates/)\n- [ ] `devcontainer stop` - Stops containers\n- [ ] `devcontainer down` - Stops and deletes containers\n\n## Try it out\n\nWe'd love for you to try out the dev container CLI and let us know what you think. You can quickly try it out in just a few simple steps, either by installing its npm package or building the CLI repo from sources (see \"[Build from sources](#build-from-sources)\").\n\nTo install the npm package you will need Python and C/C++ installed to build one of the dependencies (see, e.g., [here](https://github.com/microsoft/vscode/wiki/How-to-Contribute) for instructions).\n\n### npm install\n\n```bash\nnpm install -g @devcontainers/cli\n```\n\nVerify you can run the CLI and see its help text:\n\n```bash\ndevcontainer \u003ccommand\u003e\n\nCommands:\n  devcontainer up                   Create and run dev container\n  devcontainer build [path]         Build a dev container image\n  devcontainer run-user-commands    Run user commands\n  devcontainer read-configuration   Read configuration\n  devcontainer features             Features commands\n  devcontainer templates            Templates commands\n  devcontainer exec \u003ccmd\u003e [args..]  Execute a command on a running dev container\n\nOptions:\n  --help     Show help                                                 [boolean]\n  --version  Show version number                                       [boolean]\n```\n\n### Try out the CLI\n\nOnce you have the CLI, you can try it out with a sample project, like this [Rust sample](https://github.com/microsoft/vscode-remote-try-rust).\n\nClone the Rust sample to your machine, and start a dev container with the CLI's `up` command:\n\n```bash\ngit clone https://github.com/microsoft/vscode-remote-try-rust\ndevcontainer up --workspace-folder \u003cpath-to-vscode-remote-try-rust\u003e\n```\n\nThis will download the container image from a container registry and start the container. Your Rust container should now be running:\n\n```bash\n[88 ms] dev-containers-cli 0.1.0.\n[165 ms] Start: Run: docker build -f /home/node/vscode-remote-try-rust/.devcontainer/Dockerfile -t vsc-vscode-remote-try-rust-89420ad7399ba74f55921e49cc3ecfd2 --build-arg VARIANT=bullseye /home/node/vscode-remote-try-rust/.devcontainer\n[+] Building 0.5s (5/5) FINISHED\n =\u003e [internal] load build definition from Dockerfile                       0.0s\n =\u003e =\u003e transferring dockerfile: 38B                                        0.0s\n =\u003e [internal] load .dockerignore                                          0.0s\n =\u003e =\u003e transferring context: 2B                                            0.0s\n =\u003e [internal] load metadata for mcr.microsoft.com/vscode/devcontainers/r  0.4s\n =\u003e CACHED [1/1] FROM mcr.microsoft.com/vscode/devcontainers/rust:1-bulls  0.0s\n =\u003e exporting to image                                                     0.0s\n =\u003e =\u003e exporting layers                                                    0.0s\n =\u003e =\u003e writing image sha256:39873ccb81e6fb613975e11e37438eee1d49c963a436d  0.0s\n =\u003e =\u003e naming to docker.io/library/vsc-vscode-remote-try-rust-89420ad7399  0.0s\n[1640 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/node/vscode-remote-try-rust,target=/workspaces/vscode-remote-try-rust -l devcontainer.local_folder=/home/node/vscode-remote-try-rust --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-vscode-remote-try-rust-89420ad7399ba74f55921e49cc3ecfd2-uid -c echo Container started\nContainer started\n{\"outcome\":\"success\",\"containerId\":\"f0a055ff056c1c1bb99cc09930efbf3a0437c54d9b4644695aa23c1d57b4bd11\",\"remoteUser\":\"vscode\",\"remoteWorkspaceFolder\":\"/workspaces/vscode-remote-try-rust\"}\n```\n\nYou can then run commands in this dev container:\n\n```bash\ndevcontainer exec --workspace-folder \u003cpath-to-vscode-remote-try-rust\u003e cargo run\n```\n\nThis will compile and run the Rust sample, outputting:\n\n```bash\n[33 ms] dev-containers-cli 0.1.0.\n   Compiling hello_remote_world v0.1.0 (/workspaces/vscode-remote-try-rust)\n    Finished dev [unoptimized + debuginfo] target(s) in 1.06s\n     Running `target/debug/hello_remote_world`\nHello, VS Code Remote - Containers!\n{\"outcome\":\"success\"}\n```\n\nCongrats, you've just run the dev container CLI and seen it in action!\n\n## More CLI examples\n\nThe [example-usage](./example-usage) folder contains some simple shell scripts to illustrate how the CLI can be used to:\n\n- Inject tools for use inside a development container\n- Use a dev container as your CI build environment to build an application (even if it is not deployed as a container)\n- Build a container image from a devcontainer.json file that includes [dev container features](https://containers.dev/implementors/features/#devcontainer-json-properties)\n\n## Build from sources\n\nThis repository has a [dev container configuration](https://github.com/devcontainers/cli/tree/main/.devcontainer), which you can use to ensure you have the right dependencies installed.\n\nCompile the CLI with yarn:\n```sh\nyarn\nyarn compile\n```\n\nVerify you can run the CLI and see its help text:\n```sh\nnode devcontainer.js --help\n```\n\n## Specification\n\nThe dev container CLI is part of the [Development Containers Specification](https://github.com/devcontainers/spec). This spec seeks to find ways to enrich existing formats with common development specific settings, tools, and configuration while still providing a simplified, un-orchestrated single container option – so that they can be used as coding environments or for continuous integration and testing.\n\nLearn more on the [dev container spec website](https://devcontainers.github.io/).\n\n## Additional resources\n\nYou may review other resources part of the specification in the [`devcontainers` GitHub organization](https://github.com/devcontainers).\n\n### Documentation\n\n- Additional information on using the built-in [Features testing command](./docs/features/test.md).\n\n## Contributing\n\nCheck out how to contribute to the CLI in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nThis project is under an [MIT license](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcontainers%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevcontainers%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcontainers%2Fcli/lists"}