Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
Last active March 22, 2019 11:26
Show Gist options
  • Select an option

  • Save GeoffWilliams/4654f62f62f139a7ef63 to your computer and use it in GitHub Desktop.

Select an option

Save GeoffWilliams/4654f62f62f139a7ef63 to your computer and use it in GitHub Desktop.
Copy and paste into your .bashrc file to give a new docker subcommand 'docker bash'
docker() {
if [[ "$1" == "shell" ]]; then
if [[ "$2" == "" ]]; then
echo "usage: docker shell CONTAINER_ID"
else
command docker exec -ti $2 bash||sh
fi
else
command docker "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment