Skip to content

Instantly share code, notes, and snippets.

@tnarihi
Last active July 26, 2017 14:40
Show Gist options
  • Save tnarihi/6d88ee3b784d05acecfef7afe353ec91 to your computer and use it in GitHub Desktop.
Save tnarihi/6d88ee3b784d05acecfef7afe353ec91 to your computer and use it in GitHub Desktop.
My Docker bashrc
alias docker_build="docker build --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy}"
alias docker_run="nvidia-docker run -ehttp_proxy=${http_proxy} -ehttps_proxy=${https_proxy} -eftp_proxy=${ftp_proxy} --rm"
docker_run_user () {
tempdir=$(mktemp -d)
getent passwd > ${tempdir}/passwd
getent group > ${tempdir}/group
nvidia-docker run -ehttp_proxy=${http_proxy} -ehttps_proxy=${https_proxy} -eftp_proxy=${ftp_proxy} -v${HOME}:${HOME} -w$(pwd) --rm -u$(id -u):$(id -g) $(for i in $(id -G); do echo -n ' --group-add='$i; done)\
-v ${tempdir}/passwd:/etc/passwd:ro -v ${tempdir}/group:/etc/group:ro "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment