Created
February 2, 2024 14:28
-
-
Save edr3x/9b78ce7e417dd10f56a84e4d89e0d752 to your computer and use it in GitHub Desktop.
Switch Docker contexts easily with fzf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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