This assumes a working copy of https://github.com/junegunn/fzf in your PATH
Last active
September 9, 2015 12:38
-
-
Save cloud8421/686f321523fd2477a2c4 to your computer and use it in GitHub Desktop.
Docker shell helpers
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
findcontainer() { | |
local containers container | |
containers=$(docker-compose ps | tail -n +3 | awk '{print $1}') && | |
container=$(echo "$containers" | fzf -x) && | |
echo $container | |
} | |
dshell() { | |
local result=$(findcontainer) | |
docker exec -it $result /bin/bash | |
} | |
dlog() { | |
local result=$(findcontainer) | |
docker logs -f $result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment