Skip to content

Instantly share code, notes, and snippets.

@edr3x
Created February 2, 2024 14:28
Show Gist options
  • Save edr3x/9b78ce7e417dd10f56a84e4d89e0d752 to your computer and use it in GitHub Desktop.
Save edr3x/9b78ce7e417dd10f56a84e4d89e0d752 to your computer and use it in GitHub Desktop.
Switch Docker contexts easily with fzf
#!/usr/bin/env bash
contexts=$(docker context ls | awk '{if ($1 != "NAME") print $1}')
selected_option=$(printf "%s\n" "${contexts[@]}" | fzf --prompt="Select docker contexts: " --height=~50% --layout=reverse --border --exit-0)
docker context use $selected_option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment