Skip to content

Instantly share code, notes, and snippets.

@mrsarm
Last active March 18, 2021 12:32
Show Gist options
  • Save mrsarm/d3f17a26c84ad958ac741b75d33f2453 to your computer and use it in GitHub Desktop.
Save mrsarm/d3f17a26c84ad958ac741b75d33f2453 to your computer and use it in GitHub Desktop.
docker-volume-sh: start a shell session with the volume mounted at /data
#!/usr/bin/env bash
if [ "$#" -ne 1 -o "$1" == "-h" -o "$1" == "--help" ]; then
echo "docker-volume-sh: start a shell session with the volume mounted at /data"
echo
echo "Use: docker-volume-sh VOLUME"
echo
echo "NOTE: if VOLUME does not exist, docker creates it first"
echo
exit 2
fi
docker run --rm -it -v "$1:/data" alpine sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment