Skip to content

Instantly share code, notes, and snippets.

@sbassett29
Last active February 14, 2020 22:03
Show Gist options
  • Select an option

  • Save sbassett29/7b852bbd19771128d3d0762c95b69832 to your computer and use it in GitHub Desktop.

Select an option

Save sbassett29/7b852bbd19771128d3d0762c95b69832 to your computer and use it in GitHub Desktop.
Some helpful? docker bash commands
# License: CC0
# slightly more sane pretty-print for more obnoxiously-named Docker images
docker images --format \"table {{.Repository}}\t{{.ID}}\t{{.Tag}}\t{{.CreatedSince}}\" | awk 'NR==1 {print \$1\":\"\$2\" \"\$3\":\"\$4\":\"\$5} NR > 1 {print \"...\"substr(\$1,length(\$1)-35,36)\":\"\$2\":\"substr(\$3,0,8)\"... :\"\$4\" \"\$5\" \"\$6}' | column -t -s ':'
# an ok way to reverse-engineer an image to a docker file
docker history --no-trunc --format "{{.CreatedBy}}" $1 | tail -r | sed '/^$/d' | sed 's/^\/bin\/sh -c #(nop) *//g' | sed 's/^|[0-9]/RUN/g' | sed -e $'1s/^/FROM\\\n/' | tr -s ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment