Skip to content

Instantly share code, notes, and snippets.

@hubgit
Created June 15, 2025 20:14
Show Gist options
  • Save hubgit/4cccd848c608400b6b668219d5013001 to your computer and use it in GitHub Desktop.
Save hubgit/4cccd848c608400b6b668219d5013001 to your computer and use it in GitHub Desktop.
Open the current directory in a Docker container (zsh function)
# Open the current directory in a Docker container
function container() {
IMAGE=${1:-ubuntu:questing}
echo "Opening $PWD in $IMAGE"
docker run --rm -it -v "$PWD":/workspace -w /workspace "$IMAGE" bash
}
# Open the current directory in a Docker container (amd64)
function containeramd() {
IMAGE=${1:-ubuntu:questing}
echo "Opening $PWD in $IMAGE"
docker run --rm --platform linux/amd64 -it -v "$PWD":/workspace -w /workspace "$IMAGE" bash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment