Skip to content

Instantly share code, notes, and snippets.

@jimjh
Created April 8, 2016 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimjh/cd4ecbd47cd5f37ca15fe22861e70f58 to your computer and use it in GitHub Desktop.
Save jimjh/cd4ecbd47cd5f37ca15fe22861e70f58 to your computer and use it in GitHub Desktop.
Resize docker terminals to a sensible width/height
#!/bin/bash
# Usage: ./resize.sh [container ID]+
set -o errexit
set -o nounset
set -o pipefail
sudo apt-get -qqy install jq socat
while [[ -n ${1:-''} ]]; do
container_id=$(docker inspect ${1} | jq -r '.[0].Id')
socat unix-connect:/run/docker.sock stdio <<-HEREDOC
POST /v1.16/containers/${container_id}/resize?h=70&w=283 HTTP/1.1
HEREDOC
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment