dbash: docker bash alias with autocompletion

raw

setup.sh

1
2
3
4
5
6
7
8
function dbash() { docker exec -it "$1" bash; }
_dbash() { cur="${COMP_WORDS[COMP_CWORD]}"; __docker_complete_containers_running; }
complete -F _dbash dbash
 
# automatically login as www-data user
function dbashwww() { docker exec -it "$1" su -s /bin/bash www-data; }
complete -F _dbash dbashwww
 
Christian Weiske Christian Weiske
owner

History