Skip to content
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

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

Open
trxcllnt opened this issue May 13, 2024 · 0 comments
Open

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

trxcllnt opened this issue May 13, 2024 · 0 comments

Comments

@trxcllnt
Copy link
Contributor

trxcllnt commented May 13, 2024

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, docker buildx, etc.

Partially the motivation is similar to existing issues/PRs -- having a way to use the CLI without node would be great:

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 <args>, we find ourselves writing scripts to wrap @devcontainers/cli and mimic the behavior:

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 <path> "${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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant