Skip to content

Instantly share code, notes, and snippets.

@spuf
Created February 3, 2019 06:31
Show Gist options
  • Save spuf/7ebef9f9d2e738d6c10f2c7d739a83b4 to your computer and use it in GitHub Desktop.
Save spuf/7ebef9f9d2e738d6c10f2c7d739a83b4 to your computer and use it in GitHub Desktop.
Docker image as executable
set -euo pipefail
if [[ -t 0 ]]; then
arg_tty="--tty"
else
arg_attach="--attach stdin --attach stdout --attach stderr"
fi
exec docker run -w="$(pwd)" --volume=/tmp/:/tmp/ --volume=$HOME/:$HOME/ --volume=/Volumes/:/Volumes/ --net=host --rm --interactive ${arg_tty-} ${arg_attach-} "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment