From 44cd9416c52ddabbc938fbc62381d3bf1e85d0fa Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 3 Aug 2017 13:34:51 -0500 Subject: [PATCH] Add denter command to enter into Docker container by ID. --- .bash_profile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.bash_profile b/.bash_profile index 63d5080..e7a83ea 100644 --- a/.bash_profile +++ b/.bash_profile @@ -87,8 +87,8 @@ fi export PATH="$brew_prefix/opt/php56/bin:$PATH" # Use nvm. -export NVM_DIR="$HOME/.nvm" -. "$brew_prefix/opt/nvm/nvm.sh" +#export NVM_DIR="$HOME/.nvm" +#. "$brew_prefix/opt/nvm/nvm.sh" # Use rbenv. if [ -f /usr/local/bin/rbenv ]; then @@ -107,6 +107,17 @@ dockrun() { docker run -it geerlingguy/docker-"${1:-ubuntu1604}"-ansible /bin/bash } +# Enter a running Docker container. +function denter() { + if [[ ! "$1" ]] ; then + echo "You must supply a container ID or name." + return 0 + fi + + docker exec -it $1 bash + return 0 +} + # Delete a given line number in the known_hosts file. knownrm() { re='^[0-9]+$' @@ -145,6 +156,7 @@ function blt() { $GIT_ROOT/vendor/bin/blt "$@" else echo "You must run this command from within a BLT-generated project repository." - exit 1 + return 1 fi } +