2022-04-13 03:52:41 +08:00
|
|
|
alias dbl='docker build'
|
|
|
|
alias dcin='docker container inspect'
|
2022-04-13 21:05:55 +08:00
|
|
|
alias dcls='docker container ls'
|
|
|
|
alias dclsa='docker container ls -a'
|
2022-04-13 03:52:41 +08:00
|
|
|
alias dib='docker image build'
|
|
|
|
alias dii='docker image inspect'
|
|
|
|
alias dils='docker image ls'
|
2022-06-06 21:37:42 +08:00
|
|
|
alias dipu='docker image push'
|
2024-08-02 02:35:49 +08:00
|
|
|
alias dipru='docker image prune -a'
|
2022-04-13 03:52:41 +08:00
|
|
|
alias dirm='docker image rm'
|
|
|
|
alias dit='docker image tag'
|
2022-11-16 03:05:13 +08:00
|
|
|
alias dlo='docker container logs'
|
2022-04-13 03:52:41 +08:00
|
|
|
alias dnc='docker network create'
|
|
|
|
alias dncn='docker network connect'
|
|
|
|
alias dndcn='docker network disconnect'
|
|
|
|
alias dni='docker network inspect'
|
|
|
|
alias dnls='docker network ls'
|
|
|
|
alias dnrm='docker network rm'
|
2022-11-16 03:05:13 +08:00
|
|
|
alias dpo='docker container port'
|
2024-06-11 07:31:26 +08:00
|
|
|
alias dps='docker ps'
|
|
|
|
alias dpsa='docker ps -a'
|
2022-11-16 03:05:13 +08:00
|
|
|
alias dpu='docker pull'
|
|
|
|
alias dr='docker container run'
|
|
|
|
alias drit='docker container run -it'
|
|
|
|
alias drm='docker container rm'
|
|
|
|
alias 'drm!'='docker container rm -f'
|
|
|
|
alias dst='docker container start'
|
2022-12-15 18:47:10 +08:00
|
|
|
alias drs='docker container restart'
|
2022-11-16 03:05:33 +08:00
|
|
|
alias dsta='docker stop $(docker ps -q)'
|
2022-11-16 03:05:13 +08:00
|
|
|
alias dstp='docker container stop'
|
|
|
|
alias dtop='docker top'
|
2022-04-13 03:52:41 +08:00
|
|
|
alias dvi='docker volume inspect'
|
|
|
|
alias dvls='docker volume ls'
|
|
|
|
alias dvprune='docker volume prune'
|
2022-11-16 03:05:13 +08:00
|
|
|
alias dxc='docker container exec'
|
|
|
|
alias dxcit='docker container exec -it'
|
2023-06-16 02:06:56 +08:00
|
|
|
|
|
|
|
if (( ! $+commands[docker] )); then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2023-06-30 17:41:44 +08:00
|
|
|
# Standarized $0 handling
|
|
|
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
|
|
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
|
|
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
|
|
|
|
2023-07-20 16:43:56 +08:00
|
|
|
# If the completion file doesn't exist yet, we need to autoload it and
|
|
|
|
# bind it to `docker`. Otherwise, compinit will have already done that.
|
|
|
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
|
|
|
typeset -g -A _comps
|
|
|
|
autoload -Uz _docker
|
|
|
|
_comps[docker]=_docker
|
|
|
|
fi
|
|
|
|
|
2023-06-16 02:06:56 +08:00
|
|
|
{
|
2023-07-20 16:43:56 +08:00
|
|
|
# `docker completion` is only available from 23.0.0 on
|
2023-06-29 19:25:41 +08:00
|
|
|
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
|
|
|
|
# with `s:,:` remove the comma after the version, and select third word of it
|
2023-07-20 16:43:56 +08:00
|
|
|
if zstyle -t ':omz:plugins:docker' legacy-completion || \
|
|
|
|
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
|
|
|
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
|
|
|
else
|
2024-02-20 17:59:12 +08:00
|
|
|
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
2023-06-16 02:06:56 +08:00
|
|
|
fi
|
|
|
|
} &|
|