devcontainers / devcontainers/cli

Feature request: `@devcontainers/cli` as a docker CLI plugin

Đang mở
#827 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
feature-request
Ngôn ngữ chính
TypeScript
Star
3k
Fork
457
Merge trung bình
13 giờ 17 phút
Pull request đã merge (30 ngày)
6

Mô tả

We've found it difficult to on-board users accustomed to the docker CLI to `@devcontainers/cli`.

It would be awesome if `@devcontainers/cli` were a docker CLI front-end plugin, similar to [`docker compose`](https://github.com/docker/compose), [`docker buildx`](https://github.com/docker/buildx), etc.

Partially the motivation is similar to existing issues/PRs -- having a way to use the CLI without node would be great:
* https://github.com/devcontainers/cli/pull/343
* https://github.com/devcontainers/cli/issues/614
* https://github.com/devcontainers/cli/pull/618

This would also hopefully provide incentive to better align with docker CLI idioms. For example:
* The docker CLI has `docker build`, and Buildx/compose have `docker buildx build` and `docker compose build`.
* The docker CLI has `docker run`, and compose has `docker compose run`.
* etc.

For example, in the absence of `devcontainer run `, we find ourselves writing scripts to wrap `@devcontainers/cli` and mimic the behavior:
```shell
local container_id rm up_args exec_args;

_parse_args_somehow rm up_args exec_args;

on_exit() {
local code=$?;
if test -n "${rm-}" && test -n "${container_id-}"; then
docker rm -f "${container_id}" >/dev/null 2>&1 || true;
container_id="";
fi
exit "${code}";
}

trap on_exit EXIT;

container_id="$(devcontainer up ${rm:+--remove-existing-container} "${up_args[@]}" | jq -r '.containerId')";

devcontainer exec --workspace-folder . --config "${exec_args[@]}";
```

It would be really neat to type `docker devcontainer build .` or `docker devcontainer run --rm -it ...`, especially if the `@devcontainers/cli` plugin also shipped shell completions!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.