Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 453
Try out instructions#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
3609cde820e22e8a9697bef9af6500bef781270403025021d5eeb8dfb91153fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -10,19 +10,94 @@ A development container allows you to use a container as a full-featured develop | ||
| This CLI is in active development. Current status: | ||
| - [x] `dev-containers-cli build` - Enables building/pre-building images | ||
| - [x] `dev-containers-cli up` - Spins up containers with `devcontainer.json` settings applied | ||
| - [x] `dev-containers-cli run-user-commands` - Runs lifecycle commands like `postCreateCommand` | ||
| - [x] `dev-containers-cli read-configuration` - Outputs current configuration for workspace | ||
| - [x] `dev-containers-cli exec` - Executes a command in a container with `userEnvProbe`, `remoteUser`, `remoteEnv`, and other properties applied | ||
| - [ ] `dev-containers-cli stop` - Stops containers | ||
| - [ ] `dev-containers-cli down` - Stops and deletes containers | ||
| - [x] `devcontainer build` - Enables building/pre-building images | ||
| - [x] `devcontainer up` - Spins up containers with `devcontainer.json` settings applied | ||
| - [x] `devcontainer run-user-commands` - Runs lifecycle commands like `postCreateCommand` | ||
| - [x] `devcontainer read-configuration` - Outputs current configuration for workspace | ||
| - [x] `devcontainer exec` - Executes a command in a container with `userEnvProbe`, `remoteUser`, `remoteEnv`, and other properties applied | ||
| - [ ] `devcontainer stop` - Stops containers | ||
| - [ ] `devcontainer down` - Stops and deletes containers | ||
| ## Try it out | ||
chrmarti marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| You can try out the CLI in just a few steps. This 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. | ||
| Compile the CLI with yarn: | ||
| ```sh | ||
| yarn | ||
| yarn compile | ||
chrmarti marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ``` | ||
| Verify you can run the CLI and see its help text: | ||
| ```sh | ||
| node devcontainer.js --help | ||
| ``` | ||
| Outputs: | ||
| ``` | ||
| devcontainer <command> | ||
bamurtaugh marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Commands: | ||
| devcontainer up Create and run dev container | ||
| devcontainer build [path] Build a dev container image | ||
| devcontainer run-user-commands Run user commands | ||
| devcontainer read-configuration Read configuration | ||
| devcontainer exec <cmd> [args..] Execute a command on a running dev container | ||
| Options: | ||
| --help Show help [boolean] | ||
| --version Show version number [boolean] | ||
| ``` | ||
| You can try out the dev container CLI with a sample project, like this [Rust sample](https://github.com/microsoft/vscode-remote-try-rust). Clone the Rust sample to the repo's parent folder and start a dev container: | ||
chrmarti marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ```sh | ||
| git clone https://github.com/microsoft/vscode-remote-try-rust ../vscode-remote-try-rust | ||
| node devcontainer.js up --workspace-folder ../vscode-remote-try-rust | ||
| ``` | ||
| This will download the container image from a container registry and start the container. Your Rust container should now be running: | ||
| ``` | ||
| [88 ms] dev-containers-cli 0.1.0. | ||
| [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 | ||
| [+] Building 0.5s (5/5) FINISHED | ||
| => [internal] load build definition from Dockerfile 0.0s | ||
| => => transferring dockerfile: 38B 0.0s | ||
| => [internal] load .dockerignore 0.0s | ||
| => => transferring context: 2B 0.0s | ||
| => [internal] load metadata for mcr.microsoft.com/vscode/devcontainers/r 0.4s | ||
| => CACHED [1/1] FROM mcr.microsoft.com/vscode/devcontainers/rust:1-bulls 0.0s | ||
| => exporting to image 0.0s | ||
| => => exporting layers 0.0s | ||
| => => writing image sha256:39873ccb81e6fb613975e11e37438eee1d49c963a436d 0.0s | ||
| => => naming to docker.io/library/vsc-vscode-remote-try-rust-89420ad7399 0.0s | ||
| [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 | ||
| Container started | ||
| {"outcome":"success","containerId":"f0a055ff056c1c1bb99cc09930efbf3a0437c54d9b4644695aa23c1d57b4bd11","remoteUser":"vscode","remoteWorkspaceFolder":"/workspaces/vscode-remote-try-rust"} | ||
| ``` | ||
| You can then run some command in this dev container: | ||
| ```sh | ||
| node devcontainer.js exec --workspace-folder ../vscode-remote-try-rust cargo run | ||
| ``` | ||
| This will compile and run the Rust sample: | ||
| ``` | ||
| [33 ms] dev-containers-cli 0.1.0. | ||
| Compiling hello_remote_world v0.1.0 (/workspaces/vscode-remote-try-rust) | ||
| Finished dev [unoptimized + debuginfo] target(s) in 1.06s | ||
| Running `target/debug/hello_remote_world` | ||
| Hello, VS Code Remote - Containers! | ||
| {"outcome":"success"} | ||
| ``` | ||
chrmarti marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ## Specification | ||
| The dev container CLI is part of the [Development Containers Specification](https://github.com/microsoft/dev-container-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. | ||
| The 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. | ||
| Learn more on the [dev container spec website](https://devcontainers.github.io/containers.dev/). | ||
| Learn more on the [dev container spec website](https://devcontainers.github.io/). | ||
| ## Additional resources | ||
Uh oh!
There was an error while loading. Please reload this page.