Skip to content

Instantly share code, notes, and snippets.

@paulbrodner
Forked from yarcowang/docker-log.sh
Created July 24, 2017 18:10
Show Gist options
  • Save paulbrodner/165d4b7b8b0ce275a5bee2df17e1625a to your computer and use it in GitHub Desktop.
Save paulbrodner/165d4b7b8b0ce275a5bee2df17e1625a to your computer and use it in GitHub Desktop.

Revisions

  1. @yarcowang yarcowang revised this gist Oct 2, 2016. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion docker-log.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,10 @@ shift $((OPTIND-1))

    for commit in $($DOCKER history $1 | sed 1d | awk '{ print $1 }')
    do
    if [ "$l -eq 0" -a "$commit" == "<missing>" ]; then
    if [ $l -eq 0 ]; then
    exit 0
    elif [ "$commit" == "<missing>" ]; then
    echo "...<missing commit ids>..."
    exit 0
    elif [ $l -gt 0 ]; then
    l=$((l - 1))
  2. @yarcowang yarcowang revised this gist Oct 2, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-log.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ shift $((OPTIND-1))

    for commit in $($DOCKER history $1 | sed 1d | awk '{ print $1 }')
    do
    if [ $l -eq 0 ]; then
    if [ "$l -eq 0" -a "$commit" == "<missing>" ]; then
    exit 0
    elif [ $l -gt 0 ]; then
    l=$((l - 1))
  3. @yarcowang yarcowang revised this gist Dec 26, 2014. 1 changed file with 24 additions and 2 deletions.
    26 changes: 24 additions & 2 deletions docker-log.sh
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,35 @@

    DOCKER=`which docker`

    if [ "$#" -ne 1 ]; then
    echo "Usage: $0 IMAGE"
    usage()
    {
    echo "Usage: $(basename $0) [-l num] IMAGE"
    exit 0
    }

    if [ "$#" -lt 1 ]; then
    usage
    exit 0
    fi

    l="-1"
    while getopts ":l:" opt;
    do
    case "$opt" in
    l)
    l=$OPTARG
    ;;
    esac
    done
    shift $((OPTIND-1))

    for commit in $($DOCKER history $1 | sed 1d | awk '{ print $1 }')
    do
    if [ $l -eq 0 ]; then
    exit 0
    elif [ $l -gt 0 ]; then
    l=$((l - 1))
    fi
    content="$commit
    $($DOCKER inspect $commit | tr -d '\"' | grep 'Created\|Author\|Comment')"
    echo "$content"
  4. @yarcowang yarcowang created this gist Dec 24, 2014.
    15 changes: 15 additions & 0 deletions docker-log.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env bash

    DOCKER=`which docker`

    if [ "$#" -ne 1 ]; then
    echo "Usage: $0 IMAGE"
    exit 0
    fi

    for commit in $($DOCKER history $1 | sed 1d | awk '{ print $1 }')
    do
    content="$commit
    $($DOCKER inspect $commit | tr -d '\"' | grep 'Created\|Author\|Comment')"
    echo "$content"
    done