Skip to content

Instantly share code, notes, and snippets.

@putnamhill
Last active April 6, 2016 18:33
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 putnamhill/d8abaf4c5bf8ee326ae2 to your computer and use it in GitHub Desktop.
Save putnamhill/d8abaf4c5bf8ee326ae2 to your computer and use it in GitHub Desktop.
# Use awk to to redirect docker build output to stderr for visual feedback
# while capturing the image id on stdout when the build is sucessfull
ID=$(docker build . | awk '{print > "/dev/stderr"} END {if (/^Successfully built /) print $NF; else exit 1}')
# given docker volume path, return local storage path
doc2loc(){ docker inspect --format "{{range .Mounts}}{{if eq .Destination \"$1\"}}{{.Source}}{{end}}{{end}}" $2;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment