Add denter command to enter into Docker container by ID.

This commit is contained in:
Jeff Geerling
2017-08-03 13:34:51 -05:00
parent ac188bd320
commit 44cd9416c5
+15 -3
View File
@@ -87,8 +87,8 @@ fi
export PATH="$brew_prefix/opt/php56/bin:$PATH" export PATH="$brew_prefix/opt/php56/bin:$PATH"
# Use nvm. # Use nvm.
export NVM_DIR="$HOME/.nvm" #export NVM_DIR="$HOME/.nvm"
. "$brew_prefix/opt/nvm/nvm.sh" #. "$brew_prefix/opt/nvm/nvm.sh"
# Use rbenv. # Use rbenv.
if [ -f /usr/local/bin/rbenv ]; then if [ -f /usr/local/bin/rbenv ]; then
@@ -107,6 +107,17 @@ dockrun() {
docker run -it geerlingguy/docker-"${1:-ubuntu1604}"-ansible /bin/bash 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. # Delete a given line number in the known_hosts file.
knownrm() { knownrm() {
re='^[0-9]+$' re='^[0-9]+$'
@@ -145,6 +156,7 @@ function blt() {
$GIT_ROOT/vendor/bin/blt "$@" $GIT_ROOT/vendor/bin/blt "$@"
else else
echo "You must run this command from within a BLT-generated project repository." echo "You must run this command from within a BLT-generated project repository."
exit 1 return 1
fi fi
} }