Skip to content

Instantly share code, notes, and snippets.

@mterzo
Last active January 11, 2017 05:54
Show Gist options
  • Save mterzo/9b2de53bd8c30d9f19d1c33fe5493483 to your computer and use it in GitHub Desktop.
Save mterzo/9b2de53bd8c30d9f19d1c33fe5493483 to your computer and use it in GitHub Desktop.
Shell function to wrap python development in docker
pyenv(){
if [ $# -gt 0 ]; then
ver=$1
else
ver='2.7'
fi
case $ver in
'2.6')
name="2-6"
container='terzom/python'
;;
*)
name=$(echo $ver|awk '{sub(/\./, "-"); print}')
container="python:$ver"
;;
esac
docker run --hostname py$name -it -v ${PWD}:/src -w /src \
${container} /bin/bash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment