Skip to content

Instantly share code, notes, and snippets.

@Gordin
Created March 29, 2018 13:17
Show Gist options
  • Save Gordin/e5814eaf595a99836aa8ace33684a3f8 to your computer and use it in GitHub Desktop.
Save Gordin/e5814eaf595a99836aa8ace33684a3f8 to your computer and use it in GitHub Desktop.
Docker exec with correct Terminal size
dexec(){
CONTAINER=$1
shift
docker exec -it $CONTAINER bash -c "stty cols $COLUMNS rows $LINES && $*";
}
_dexec(){
COMPREPLY=( $(docker ps --format "{{.Names}}" -f name=$2) );
}
complete -F _dexec dexec;
export dexec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment