Skip to content

Instantly share code, notes, and snippets.

@xlc
Created November 24, 2023 01:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlc/c772d189e81c6366a599ef65c4900ff0 to your computer and use it in GitHub Desktop.
Save xlc/c772d189e81c6366a599ef65c4900ff0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
tmux new-session -d -s logs || true
for name in `docker ps --format json | jq -s 'sort_by(.Names)|.[].Names)'`
do
tmux split-window -h -f
tmux send-keys "docker logs -f -n 20 $name" C-m
tmux select-pane -T $name
done
tmux kill-pane -t 0
tmux select-layout even-vertical
tmux attach-session -t logs
@xlc
Copy link
Author

xlc commented Nov 24, 2023

Display the logs for each running docker container in own tmux pane

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