-
-
Save dcreager/5b66e8bfeeb4a4695ec3 to your computer and use it in GitHub Desktop.
Script to run a docker image with $PWD available inside and with SSH forwarding
This file contains hidden or 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/sh | |
if [ -n "$SSH_AUTH_SOCK" ]; then | |
SSH_AUTH_DIR=`dirname $SSH_AUTH_SOCK` | |
SSH_OPTS="-v $SSH_AUTH_DIR:$SSH_AUTH_DIR -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK" | |
fi | |
IMAGE=$1 | |
shift | |
docker run \ | |
-i -t --rm \ | |
$SSH_OPTS \ | |
-v "$PWD":/outside \ | |
-w /outside \ | |
$IMAGE \ | |
/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment