Last active
August 1, 2021 21:30
-
-
Save petehunt/bb2eca02b43fcf61a52178dea83f475e to your computer and use it in GitHub Desktop.
Create a fresh Ubuntu instance tied to your current working directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
CONTAINER="$(pwd | sha256sum | awk '{print $1}')" | |
if docker inspect "$CONTAINER" 2> /dev/null > /dev/null; | |
then | |
docker start "$CONTAINER" -ai | |
else | |
docker run --name="$CONTAINER" -v $(pwd):/root -w /root -ti ubuntu bash | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment