Skip to content

Instantly share code, notes, and snippets.

@wuub
Last active January 13, 2016 16:19
Show Gist options
  • Save wuub/2ce81072ff97fdcf3816 to your computer and use it in GitHub Desktop.
Save wuub/2ce81072ff97fdcf3816 to your computer and use it in GitHub Desktop.
$ dockmux $(docker ps -q)
#!/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
@wuub
Copy link
Author

wuub commented Jan 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment