Skip to content

Instantly share code, notes, and snippets.

@enil
Created April 17, 2017 14:07
Show Gist options
  • Save enil/33e3ced4eff0699e043efc0830db7a3b to your computer and use it in GitHub Desktop.
Save enil/33e3ced4eff0699e043efc0830db7a3b to your computer and use it in GitHub Desktop.
Build and run a temporary Docker image contained in a shell script
#!/bin/sh
TAG=$(uuidgen | tr -d '-' | tr '[A-Z]' '[a-z]')
docker build -t $TAG - << EOF
FROM debian
ENTRYPOINT ["echo", "Hello world from ${TAG}!"]
EOF
docker run --rm $TAG
docker rmi $TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment