DockerCTX, Switch Context like KubeCTX

Docker logo

Rewrite of ahmetb’s “kubectx” utility. https://github.com/ahmetb/kubectx

The dockerctx application is a command-line tool designed to make it easier to manage Docker contexts. Docker contexts allow you to switch between different Docker hosts and environments, making it possible to manage multiple Docker environments with a single Docker CLI. This is particularly useful for developers and DevOps engineers who need to work with multiple Docker environments, such as local development, staging, and production environments.

With dockerctx, you can easily switch between Docker contexts without having to manually set environment variables or configure Docker settings each time you switch contexts.

Missing functionality compared to KubeCTX

Rename Context

The docker context command does not allow context renaming, therefore this feature is omitted from DockerCTX.

unset_context() func

The docker context command does not allow context unset, therefore this feature is omitted from DockerCTX.

Installation via Homebrew

brew install stenstromen/tap/dockerctx
  • For Linux: Checkout and download the latest script from Releases page

Example Usage

dockerctx               : list the contexts
dockerctx <NAME>        : switch to context <NAME>
dockerctx -             : switch to the previous context
dockerctx -c, --current : show the current context name
dockerctx -d <NAME>     : delete context <NAME> ('.' for current-context)

dockerctx -h,--help     : show this message

Leave a Reply

Your email address will not be published. Required fields are marked *