Last active
January 13, 2016 16:19
-
-
Save wuub/2ce81072ff97fdcf3816 to your computer and use it in GitHub Desktop.
$ dockmux $(docker ps -q)
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
#!/bin/bash | |
if [[ -e ~/.dockmux/$1 ]]; then | |
CONTAINERS=$(cat ~/.dockmux/$1) | |
SESSION_NAME=$1 | |
else | |
CONTAINERS="$@" | |
SESSION_NAME=dockmux | |
fi | |
tmux new-session -d -s $SESSION_NAME | |
shift | |
for CONTAINER in $CONTAINERS; do | |
tmux new-window -n `docker inspect -f ''{{.Config.Hostname}}'' $CONTAINER` "docker exec -i -t $CONTAINER /bin/bash" | |
done | |
tmux kill-window -t 0 | |
tmux select-window -t 1 | |
tmux attach -t $SESSION_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credits to http://github.com/wbond/mtmux.git