Fix dependency of docker aliases on docker plugin
Some of the docker aliases use functions found in the docker plugin. If the plugin is not enabled, these aliases do not work. This commit only defines the aliases if the plugin is enabled. Also changed: `dkelc` now creates an explicit login shell, has the synonym `dkbash` and uses no backticks. Reason: on some docker images the status as login-shell is not set automatically, which causes e.g. `/etc/bash.bashrc` and `/etc/profile` not to be loaded in these images. Note: There should be a convenience function in `lib/helpers.bash` that checks if a plugin is available/enabled/disabled. The if-statement if rather clonky.pull/1285/head
parent
247b00fc36
commit
7136604b57
|
|
@ -9,7 +9,6 @@ alias dkps='docker ps' # List running Docker containers
|
||||||
alias dkpsa='docker ps -a' # List all Docker containers
|
alias dkpsa='docker ps -a' # List all Docker containers
|
||||||
alias dki='docker images' # List Docker images
|
alias dki='docker images' # List Docker images
|
||||||
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
||||||
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
|
||||||
|
|
||||||
case $OSTYPE in
|
case $OSTYPE in
|
||||||
darwin*|*bsd*|*BSD*)
|
darwin*|*bsd*|*BSD*)
|
||||||
|
|
@ -20,12 +19,17 @@ case $OSTYPE in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ ! -z "$(command ls "${BASH_IT}/$subdirectory/"{[0-9][0-9][0-9]${BASH_IT_LOAD_PRIORITY_SEPARATOR}docker,docker}.plugin.bash 2>/dev/null | head -1)" ]; then
|
||||||
|
# Function aliases from docker plugin:
|
||||||
|
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
||||||
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
|
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
|
||||||
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
||||||
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
||||||
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
||||||
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
|
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
|
||||||
alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above)
|
fi
|
||||||
|
alias dkelc='docker exec -it $(dklcid) bash --login' # Enter last container (works with Docker 1.3 and above)
|
||||||
|
alias dkbash='dkelc'
|
||||||
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
||||||
alias dkri='docker run --rm -i '
|
alias dkri='docker run --rm -i '
|
||||||
alias dkrit='docker run --rm -it '
|
alias dkrit='docker run --rm -it '
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue