Skip to content

Instantly share code, notes, and snippets.

@dmcgowan
Created September 20, 2016 18:38
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 dmcgowan/a64d67a6ac067f40598a3ce9473c0823 to your computer and use it in GitHub Desktop.
Save dmcgowan/a64d67a6ac067f40598a3ce9473c0823 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
tmpdir=$(mktemp -d)
volume=$1
shift
if [ ! -f $volume ]; then
fallocate -l 512M $volume
fi
device=$(losetup -f --show $volume)
mkfs.xfs -f $device
mount $device $tmpdir $@
# Show mount
mount | grep $tmpdir
function cleanup() {
sleep 1
umount -rf $tmpdir
losetup -d $device
rmdir $tmpdir
}
trap cleanup EXIT
docker daemon -D -s overlay2 -g $tmpdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment