linux下二进制安装docker最新版docker-24.0.6
一.基础环境
本次实操是公司技术培训下基于centos7.9操作系统安装docker最新版docker-24.0.6,下载地址是:https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz
二. 下载Docker压缩包
mkdir -p /opt/docker-soft
cd /opt/docker-soft
wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz
三.解压压缩包
tar xf docker-24.0.6.tgz
解压缩后会出现一个docker文件夹,具体内容如下
[root@TDCS docker-soft]# cd docker
[root@TDCS docker]# ll
总用量 182244
-rwxr-xr-x 1 1000 1000 39129088 9月 4 20:34 containerd
-rwxr-xr-x 1 1000 1000 12374016 9月 4 20:34 containerd-shim-runc-v2
-rwxr-xr-x 1 1000 1000 19140608 9月 4 20:34 ctr
-rwxr-xr-x 1 1000 1000 34752096 9月 4 20:34 docker
-rwxr-xr-x 1 1000 1000 63346888 9月 4 20:34 dockerd
-rwxr-xr-x 1 1000 1000 761712 9月 4 20:34 docker-init
-rwxr-xr-x 1 1000 1000 1965694 9月 4 20:34 docker-proxy
-rwxr-xr-x 1 1000 1000 15142440 9月 4 20:34 runc
四.docker相关的二进制文件软链接或者拷贝到指定的/usr/bin目录
二者操作其一即可
1.做软链接
ln -sv /opt/docker-soft/docker/* /usr/bin/2.拷贝二进制文件到/usr/bin/
/opt/docker-soft/docker/* /usr/bin/
五.创建containerd的service文件,并且启动
cat > /usr/lib/systemd/system/containerd.service <<EOF
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerdType=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=1048576
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999[Install]
WantedBy=multi-user.target
EOF
启动containerd
#启动
systemctl enable containerd.service && systemctl restart containerd#查看状态
systemctl status containerd
五.创建docker的service文件
#docker.service文件
cat > /usr/lib/systemd/system/docker.service <<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500[Install]
WantedBy=multi-user.target
EOF#docker.socket文件
cat > /usr/lib/systemd/system/docker.socket <<EOF
[Unit]
Description=Docker Socket for the API[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker[Install]
WantedBy=sockets.target
EOF
六.创建docker组
#创建docker组
groupadd docker
七.启动docker
#启动
systemctl enable docker.service && systemctl restart docker
#查看状态
systemctl status docker#验证
docker info
八.操作系统内核优化
vi /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
vm.swappiness=0
九.docker优化配置
mkdir -p /etc/docker
cat >/etc/docker/daemon.json <<EOF
{"data-root": "/var/lib/docker", #数据目录"storage-driver": "overlay2", // 存储驱动程序"storage-opts": ["overlay2.override_kernel_check=true"],"max-concurrent-downloads": 10,"max-concurrent-uploads": 5,"registry-mirrors": ["https://9916w1ow.mirror.aliyuncs.com"], #注册表的镜像集合,加快镜像下载速度"exec-opts": ["native.cgroupdriver=systemd"], #默认的cgroup driver"log-opts": { // 设置日志选项"max-file": "5","max-size": "100m"},"live-restore": true
}
EOF
常用的配置如下:
log-driver:设置 Docker 层级记录使用的默认日志驱动器,可能的值包括 json-file、syslog和journald,默认为 json-file。
log-opts:通过 log-driver 设置的默认日志选项。可选择的日志选项根据所使用的各种驱动程序而异。
storage-driver:设置容器使用的默认存储驱动程序。可能的值包括 aufs、devicemapper、btrfs、vfs等,不同的驱动程序可能会对性能和稳定性产生不同的影响。从 Docker 19.03 开始,默认值为 overlay2。
iptables:指定是否启用 Docker 管理的 iptables 规则,默认为 true。
ipv6:启用或禁用IPv6支持,默认为false。
registry-mirrors:设置 Docker Hub 镜像的镜像地址
max-concurrent-downloads # 下载并发数
max-concurrent-uploads # 上传并发数
live-restore # 开启这个参数,重启docker不会影响上面的参数报错failed to start daemon: error initializing graphdriver: overlay2: unknown option overlay2.override_kernel_check
去掉
"storage-opts": [
"overlay2.override_kernel_check=true"
],
十.修改配置后验证启动
启动
systemctl restart docker
# 查看docker版本
docker --version#docker信息
docker info # 验证dokcer启动
docker run hello-world
十一.docker命令补全
配置docker命令的命令补全功能
yum install -y bash-completion
source /usr/share/bash-completion/completions/docker
source /usr/share/bash-completion/bash_completion如果提示没有/usr/share/bash-completion/completions/docker这个文件,在/usr/share/bash-completion/completions/目录下创建一个,再执行
vi docker
#!/usr/bin/env bash
# shellcheck disable=SC2016,SC2119,SC2155,SC2206,SC2207
#
# Shellcheck ignore list:
# - SC2016: Expressions don't expand in single quotes, use double quotes for that.
# - SC2119: Use foo "$@" if function's $1 should mean script's $1.
# - SC2155: Declare and assign separately to avoid masking return values.
# - SC2206: Quote to prevent word splitting, or split robustly with mapfile or read -a.
# - SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#
# You can find more details for each warning at the following page:
# https://github.com/koalaman/shellcheck/wiki/<SCXXXX>
#
# bash completion file for core docker commands
#
# This script provides completion of:
# - commands and their options
# - container ids and names
# - image repos and tags
# - filepaths
#
# To enable the completions either:
# - place this file in /etc/bash_completion.d
# or
# - copy this file to e.g. ~/.docker-completion.sh and add the line
# below to your .bashrc after bash completion features are loaded
# . ~/.docker-completion.sh
#
# Configuration:
#
# For several commands, the amount of completions can be configured by
# setting environment variables.
#
# DOCKER_COMPLETION_SHOW_CONFIG_IDS
# DOCKER_COMPLETION_SHOW_CONTAINER_IDS
# DOCKER_COMPLETION_SHOW_NETWORK_IDS
# DOCKER_COMPLETION_SHOW_NODE_IDS
# DOCKER_COMPLETION_SHOW_PLUGIN_IDS
# DOCKER_COMPLETION_SHOW_SECRET_IDS
# DOCKER_COMPLETION_SHOW_SERVICE_IDS
# "no" - Show names only (default)
# "yes" - Show names and ids
#
# You can tailor completion for the "events", "history", "inspect", "run",
# "rmi" and "save" commands by settings the following environment
# variables:
#
# DOCKER_COMPLETION_SHOW_IMAGE_IDS
# "none" - Show names only (default)
# "non-intermediate" - Show names and ids, but omit intermediate image IDs
# "all" - Show names and ids, including intermediate image IDs
#
# DOCKER_COMPLETION_SHOW_TAGS
# "yes" - include tags in completion options (default)
# "no" - don't include tags in completion options#
# Note:
# Currently, the completions will not work if the docker daemon is not
# bound to the default communication port/socket
# If the docker daemon is using a unix socket for communication your user
# must have access to the socket for the completions to function correctly
#
# Note for developers:
# Please arrange options sorted alphabetically by long name with the short
# options immediately following their corresponding long form.
# This order should be applied to lists, alternatives and code blocks.__docker_previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob__docker_q() {docker ${host:+-H "$host"} ${config:+--config "$config"} 2>/dev/null "$@"
}# __docker_configs returns a list of configs. Additional options to
# `docker config ls` may be specified in order to filter the list, e.g.
# `__docker_configs --filter label=stage=production`.
# By default, only names are returned.
# Set DOCKER_COMPLETION_SHOW_CONFIG_IDS=yes to also complete IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
__docker_configs() {local formatif [ "$1" = "--id" ] ; thenformat='{{.ID}}'shiftelif [ "$1" = "--name" ] ; thenformat='{{.Name}}'shiftelif [ "$DOCKER_COMPLETION_SHOW_CONFIG_IDS" = yes ] ; thenformat='{{.ID}} {{.Name}}'elseformat='{{.Name}}'fi__docker_q config ls --format "$format" "$@"
}# __docker_complete_configs applies completion of configs based on the current value
# of `$cur` or the value of the optional first option `--cur`, if given.
__docker_complete_configs() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_configs "$@")" -- "$current") )
}# __docker_containers returns a list of containers. Additional options to
# `docker ps` may be specified in order to filter the list, e.g.
# `__docker_containers --filter status=running`
# By default, only names are returned.
# Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
__docker_containers() {local formatif [ "$1" = "--id" ] ; thenformat='{{.ID}}'shiftelif [ "$1" = "--name" ] ; thenformat='{{.Names}}'shiftelif [ "${DOCKER_COMPLETION_SHOW_CONTAINER_IDS}" = yes ] ; thenformat='{{.ID}} {{.Names}}'elseformat='{{.Names}}'fi__docker_q ps --format "$format" "$@"
}# __docker_complete_containers applies completion of containers based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_containers`.
__docker_complete_containers() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_containers "$@")" -- "$current") )
}__docker_complete_containers_all() {__docker_complete_containers "$@" --all
}# shellcheck disable=SC2120
__docker_complete_containers_removable() {__docker_complete_containers "$@" --filter status=created --filter status=exited
}__docker_complete_containers_running() {__docker_complete_containers "$@" --filter status=running
}# shellcheck disable=SC2120
__docker_complete_containers_stopped() {__docker_complete_containers "$@" --filter status=exited
}# shellcheck disable=SC2120
__docker_complete_containers_unpauseable() {__docker_complete_containers "$@" --filter status=paused
}__docker_complete_container_names() {local containers=( $(__docker_q ps -aq --no-trunc) )local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") )names=( "${names[@]#/}" ) # trim off the leading "/" from the container namesCOMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") )
}__docker_complete_container_ids() {local containers=( $(__docker_q ps -aq) )COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
}# __docker_images returns a list of images. For each image, up to three representations
# can be generated: the repository (e.g. busybox), repository:tag (e.g. busybox:latest)
# and the ID (e.g. sha256:ee22cbbd4ea3dff63c86ba60c7691287c321e93adfc1009604eb1dde7ec88645).
#
# The optional arguments `--repo`, `--tag` and `--id` select the representations that
# may be returned. Whether or not a particular representation is actually returned
# depends on the user's customization through several environment variables:
# - image IDs are only shown if DOCKER_COMPLETION_SHOW_IMAGE_IDS=all|non-intermediate.
# - tags can be excluded by setting DOCKER_COMPLETION_SHOW_TAGS=no.
# - repositories are always shown.
#
# In cases where an exact image specification is needed, `--force-tag` can be used.
# It ignores DOCKER_COMPLETION_SHOW_TAGS and only lists valid repository:tag combinations,
# avoiding repository names that would default to a potentially missing default tag.
#
# Additional arguments to `docker image ls` may be specified in order to filter the list,
# e.g. `__docker_images --filter dangling=true`.
#
__docker_images() {local repo_format='{{.Repository}}'local tag_format='{{.Repository}}:{{.Tag}}'local id_format='{{.ID}}'local alllocal formatif [ "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" = "all" ] ; thenall='--all'fiwhile true ; docase "$1" in--repo)format+="$repo_format\n"shift;;--tag)if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; thenformat+="$tag_format\n"fishift;;--id)if [[ $DOCKER_COMPLETION_SHOW_IMAGE_IDS =~ ^(all|non-intermediate)$ ]] ; thenformat+="$id_format\n"fishift;;--force-tag)# like `--tag` but ignores environment settingformat+="$tag_format\n"shift;;*)break;;esacdone__docker_q image ls --no-trunc --format "${format%\\n}" $all "$@" | grep -v '<none>$'
}# __docker_complete_images applies completion of images based on the current value of `$cur` or
# the value of the optional first option `--cur`, if given.
# See __docker_images for customization of the returned items.
__docker_complete_images() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_images "$@")" -- "$current") )__ltrim_colon_completions "$current"
}# __docker_networks returns a list of all networks. Additional options to
# `docker network ls` may be specified in order to filter the list, e.g.
# `__docker_networks --filter type=custom`
# By default, only names are returned.
# Set DOCKER_COMPLETION_SHOW_NETWORK_IDS=yes to also complete IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
__docker_networks() {local formatif [ "$1" = "--id" ] ; thenformat='{{.ID}}'shiftelif [ "$1" = "--name" ] ; thenformat='{{.Name}}'shiftelif [ "${DOCKER_COMPLETION_SHOW_NETWORK_IDS}" = yes ] ; thenformat='{{.ID}} {{.Name}}'elseformat='{{.Name}}'fi__docker_q network ls --format "$format" "$@"
}# __docker_complete_networks applies completion of networks based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_networks`.
__docker_complete_networks() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_networks "$@")" -- "$current") )
}__docker_complete_containers_in_network() {local containers=($(__docker_q network inspect -f '{{range $i, $c := .Containers}}{{$i}} {{$c.Name}} {{end}}' "$1"))COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
}# __docker_volumes returns a list of all volumes. Additional options to
# `docker volume ls` may be specified in order to filter the list, e.g.
# `__docker_volumes --filter dangling=true`
# Because volumes do not have IDs, this function does not distinguish between
# IDs and names.
__docker_volumes() {__docker_q volume ls -q "$@"
}# __docker_complete_volumes applies completion of volumes based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_volumes`.
__docker_complete_volumes() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_volumes "$@")" -- "$current") )
}# __docker_plugins_bundled returns a list of all plugins of a given type.
# The type has to be specified with the mandatory option `--type`.
# Valid types are: Network, Volume, Authorization.
# Completions may be added or removed with `--add` and `--remove`
# This function only deals with plugins that come bundled with Docker.
# For plugins managed by `docker plugin`, see `__docker_plugins_installed`.
__docker_plugins_bundled() {local type add=() remove=()while true ; docase "$1" in--type)type="$2"shift 2;;--add)add+=("$2")shift 2;;--remove)remove+=("$2")shift 2;;*)break;;esacdonelocal plugins=($(__docker_q info --format "{{range \$i, \$p := .Plugins.$type}}{{.}} {{end}}"))for del in "${remove[@]}" ; doplugins=(${plugins[@]/$del/})doneecho "${plugins[@]}" "${add[@]}"
}# __docker_complete_plugins_bundled applies completion of plugins based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# The plugin type has to be specified with the next option `--type`.
# This function only deals with plugins that come bundled with Docker.
# For completion of plugins managed by `docker plugin`, see
# `__docker_complete_plugins_installed`.
__docker_complete_plugins_bundled() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_plugins_bundled "$@")" -- "$current") )
}# __docker_plugins_installed returns a list of all plugins that were installed with
# the Docker plugin API.
# By default, only names are returned.
# Set DOCKER_COMPLETION_SHOW_PLUGIN_IDS=yes to also complete IDs.
# Additional options to `docker plugin ls` may be specified in order to filter the list,
# e.g. `__docker_plugins_installed --filter enabled=true`
# For built-in pugins, see `__docker_plugins_bundled`.
__docker_plugins_installed() {local formatif [ "$DOCKER_COMPLETION_SHOW_PLUGIN_IDS" = yes ] ; thenformat='{{.ID}} {{.Name}}'elseformat='{{.Name}}'fi__docker_q plugin ls --format "$format" "$@"
}# __docker_complete_plugins_installed applies completion of plugins that were installed
# with the Docker plugin API, based on the current value of `$cur` or the value of
# the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_plugins_installed`.
# For completion of built-in pugins, see `__docker_complete_plugins_bundled`.
__docker_complete_plugins_installed() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_plugins_installed "$@")" -- "$current") )
}__docker_runtimes() {__docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p'
}__docker_complete_runtimes() {COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
}# __docker_secrets returns a list of secrets. Additional options to
# `docker secret ls` may be specified in order to filter the list, e.g.
# `__docker_secrets --filter label=stage=production`
# By default, only names are returned.
# Set DOCKER_COMPLETION_SHOW_SECRET_IDS=yes to also complete IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
__docker_secrets() {local formatif [ "$1" = "--id" ] ; thenformat='{{.ID}}'shiftelif [ "$1" = "--name" ] ; thenformat='{{.Name}}'shiftelif [ "$DOCKER_COMPLETION_SHOW_SECRET_IDS" = yes ] ; thenformat='{{.ID}} {{.Name}}'elseformat='{{.Name}}'fi__docker_q secret ls --format "$format" "$@"
}# __docker_complete_secrets applies completion of secrets based on the current value
# of `$cur` or the value of the optional first option `--cur`, if given.
__docker_complete_secrets() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_secrets "$@")" -- "$current") )
}# __docker_stacks returns a list of all stacks.
__docker_stacks() {__docker_q stack ls | awk 'NR>1 {print $1}'
}# __docker_complete_stacks applies completion of stacks based on the current value
# of `$cur` or the value of the optional first option `--cur`, if given.
__docker_complete_stacks() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_stacks "$@")" -- "$current") )
}# __docker_nodes returns a list of all nodes. Additional options to
# `docker node ls` may be specified in order to filter the list, e.g.
# `__docker_nodes --filter role=manager`
# By default, only node names are returned.
# Set DOCKER_COMPLETION_SHOW_NODE_IDS=yes to also complete node IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
# Completions may be added with `--add`, e.g. `--add self`.
__docker_nodes() {local formatif [ "$DOCKER_COMPLETION_SHOW_NODE_IDS" = yes ] ; thenformat='{{.ID}} {{.Hostname}}'elseformat='{{.Hostname}}'filocal add=()while true ; docase "$1" in--id)format='{{.ID}}'shift;;--name)format='{{.Hostname}}'shift;;--add)add+=("$2")shift 2;;*)break;;esacdoneecho "$(__docker_q node ls --format "$format" "$@")" "${add[@]}"
}# __docker_complete_nodes applies completion of nodes based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_nodes`.
__docker_complete_nodes() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_nodes "$@")" -- "$current") )
}# __docker_services returns a list of all services. Additional options to
# `docker service ls` may be specified in order to filter the list, e.g.
# `__docker_services --filter name=xxx`
# By default, only node names are returned.
# Set DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes to also complete IDs.
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
__docker_services() {local fields='$2' # default: service name only[ "${DOCKER_COMPLETION_SHOW_SERVICE_IDS}" = yes ] && fields='$1,$2' # ID & nameif [ "$1" = "--id" ] ; thenfields='$1' # IDs onlyshiftelif [ "$1" = "--name" ] ; thenfields='$2' # names onlyshiftfi__docker_q service ls "$@" | awk "NR>1 {print $fields}"
}# __docker_complete_services applies completion of services based on the current
# value of `$cur` or the value of the optional first option `--cur`, if given.
# Additional filters may be appended, see `__docker_services`.
__docker_complete_services() {local current="$cur"if [ "$1" = "--cur" ] ; thencurrent="$2"shift 2fiCOMPREPLY=( $(compgen -W "$(__docker_services "$@")" -- "$current") )
}# __docker_tasks returns a list of all task IDs.
__docker_tasks() {__docker_q service ps --format '{{.ID}}' ""
}# __docker_complete_services_and_tasks applies completion of services and task IDs.
# shellcheck disable=SC2120
__docker_complete_services_and_tasks() {COMPREPLY=( $(compgen -W "$(__docker_services "$@") $(__docker_tasks)" -- "$cur") )
}# __docker_append_to_completions appends the word passed as an argument to every
# word in `$COMPREPLY`.
# Normally you do this with `compgen -S` while generating the completions.
# This function allows you to append a suffix later. It allows you to use
# the __docker_complete_XXX functions in cases where you need a suffix.
__docker_append_to_completions() {COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
}# __docker_fetch_info fetches information about the configured Docker server and updates
# several variables with the results.
# The result is cached for the duration of one invocation of bash completion.
__docker_fetch_info() {if [ -z "$info_fetched" ] ; thenread -r client_experimental server_experimental server_os <<< "$(__docker_q version -f '{{.Client.Experimental}} {{.Server.Experimental}} {{.Server.Os}}')"info_fetched=truefi
}# __docker_client_is_experimental tests whether the Docker cli is configured to support
# experimental features. If so, the function exits with 0 (true).
# Otherwise, or if the result cannot be determined, the exit value is 1 (false).
__docker_client_is_experimental() {__docker_fetch_info[ "$client_experimental" = "true" ]
}# __docker_server_is_experimental tests whether the currently configured Docker
# server runs in experimental mode. If so, the function exits with 0 (true).
# Otherwise, or if the result cannot be determined, the exit value is 1 (false).
__docker_server_is_experimental() {__docker_fetch_info[ "$server_experimental" = "true" ]
}# __docker_server_os_is tests whether the currently configured Docker server runs
# on the operating system passed in as the first argument.
# Known operating systems: linux, windows.
__docker_server_os_is() {local expected_os="$1"__docker_fetch_info[ "$server_os" = "$expected_os" ]
}# __docker_stack_orchestrator_is tests whether the client is configured to use
# the orchestrator that is passed in as the first argument.
__docker_stack_orchestrator_is() {case "$1" inkubernetes)if [ -z "$stack_orchestrator_is_kubernetes" ] ; then__docker_q stack ls --help | grep -qe --namespacestack_orchestrator_is_kubernetes=$?fireturn $stack_orchestrator_is_kubernetes;;swarm)if [ -z "$stack_orchestrator_is_swarm" ] ; then__docker_q stack deploy --help | grep -qe "with-registry-auth"stack_orchestrator_is_swarm=$?fireturn $stack_orchestrator_is_swarm;;*)return 1;;esac
}# __docker_pos_first_nonflag finds the position of the first word that is neither
# option nor an option's argument. If there are options that require arguments,
# you should pass a glob describing those options, e.g. "--option1|-o|--option2"
# Use this function to restrict completions to exact positions after the argument list.
__docker_pos_first_nonflag() {local argument_flags=$1local counter=$((${subcommand_pos:-${command_pos}} + 1))while [ "$counter" -le "$cword" ]; doif [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then(( counter++ ))# eat "=" in case of --option=arg syntax[ "${words[$counter]}" = "=" ] && (( counter++ ))elsecase "${words[$counter]}" in-*);;*)break;;esacfi# Bash splits words at "=", retaining "=" as a word, examples:# "--debug=false" => 3 words, "--log-opt syslog-facility=daemon" => 4 wordswhile [ "${words[$counter + 1]}" = "=" ] ; docounter=$(( counter + 2))done(( counter++ ))doneecho $counter
}# __docker_map_key_of_current_option returns `key` if we are currently completing the
# value of a map option (`key=value`) which matches the extglob given as an argument.
# This function is needed for key-specific completions.
__docker_map_key_of_current_option() {local glob="$1"local key glob_posif [ "$cur" = "=" ] ; then # key= casekey="$prev"glob_pos=$((cword - 2))elif [[ $cur == *=* ]] ; then # key=value case (OSX)key=${cur%=*}glob_pos=$((cword - 1))elif [ "$prev" = "=" ] ; thenkey=${words[$cword - 2]} # key=value caseglob_pos=$((cword - 3))elsereturnfi[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
}# __docker_value_of_option returns the value of the first option matching `option_glob`.
# Valid values for `option_glob` are option names like `--log-level` and globs like
# `--log-level|-l`
# Only positions between the command and the current word are considered.
__docker_value_of_option() {local option_extglob=$(__docker_to_extglob "$1")local counter=$((command_pos + 1))while [ "$counter" -lt "$cword" ]; docase ${words[$counter]} in$option_extglob )echo "${words[$counter + 1]}"break;;esac(( counter++ ))done
}# __docker_to_alternatives transforms a multiline list of strings into a single line
# string with the words separated by `|`.
# This is used to prepare arguments to __docker_pos_first_nonflag().
__docker_to_alternatives() {local parts=( $1 )local IFS='|'echo "${parts[*]}"
}# __docker_to_extglob transforms a multiline list of options into an extglob pattern
# suitable for use in case statements.
__docker_to_extglob() {local extglob=$( __docker_to_alternatives "$1" )echo "@($extglob)"
}# __docker_subcommands processes subcommands
# Locates the first occurrence of any of the subcommands contained in the
# first argument. In case of a match, calls the corresponding completion
# function and returns 0.
# If no match is found, 1 is returned. The calling function can then
# continue processing its completion.
#
# TODO if the preceding command has options that accept arguments and an
# argument is equal ot one of the subcommands, this is falsely detected as
# a match.
__docker_subcommands() {local subcommands="$1"local counter=$((command_pos + 1))while [ "$counter" -lt "$cword" ]; docase "${words[$counter]}" in$(__docker_to_extglob "$subcommands") )subcommand_pos=$counterlocal subcommand=${words[$counter]}local completions_func=_docker_${command}_${subcommand//-/_}declare -F "$completions_func" >/dev/null && "$completions_func"return 0;;esac(( counter++ ))donereturn 1
}# __docker_nospace suppresses trailing whitespace
__docker_nospace() {# compopt is not available in ancient bash versionstype compopt &>/dev/null && compopt -o nospace
}__docker_complete_resolved_hostname() {command -v host >/dev/null 2>&1 || returnCOMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') )
}# __docker_local_interfaces returns a list of the names and addresses of all
# local network interfaces.
# If `--ip-only` is passed as a first argument, only addresses are returned.
__docker_local_interfaces() {command -v ip >/dev/null 2>&1 || returnlocal formatif [ "$1" = "--ip-only" ] ; thenformat='\1'shiftelseformat='\1 \2'fiip addr show scope global 2>/dev/null | sed -n "s| \+inet \([0-9.]\+\).* \([^ ]\+\)|$format|p"
}# __docker_complete_local_interfaces applies completion of the names and addresses of all
# local network interfaces based on the current value of `$cur`.
# An additional value can be added to the possible completions with an `--add` argument.
__docker_complete_local_interfaces() {local additional_interfaceif [ "$1" = "--add" ] ; thenadditional_interface="$2"shift 2fiCOMPREPLY=( $( compgen -W "$(__docker_local_interfaces "$@") $additional_interface" -- "$cur" ) )
}# __docker_complete_local_ips applies completion of the addresses of all local network
# interfaces based on the current value of `$cur`.
__docker_complete_local_ips() {__docker_complete_local_interfaces --ip-only
}# __docker_complete_capabilities_addable completes Linux capabilities which are
# not granted by default and may be added.
# see https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities
__docker_complete_capabilities_addable() {COMPREPLY=( $( compgen -W "ALLAUDIT_CONTROLBLOCK_SUSPENDDAC_READ_SEARCHIPC_LOCKIPC_OWNERLEASELINUX_IMMUTABLEMAC_ADMINMAC_OVERRIDENET_ADMINNET_BROADCASTSYS_ADMINSYS_BOOTSYSLOGSYS_MODULESYS_NICESYS_PACCTSYS_PTRACESYS_RAWIOSYS_RESOURCESYS_TIMESYS_TTY_CONFIGWAKE_ALARM" -- "$cur" ) )
}# __docker_complete_capabilities_droppable completes Linux capability options which are
# allowed by default and can be dropped.
# see https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities
__docker_complete_capabilities_droppable() {COMPREPLY=( $( compgen -W "ALLAUDIT_WRITECHOWNDAC_OVERRIDEFOWNERFSETIDKILLMKNODNET_BIND_SERVICENET_RAWSETFCAPSETGIDSETPCAPSETUIDSYS_CHROOT" -- "$cur" ) )
}__docker_complete_detach_keys() {case "$prev" in--detach-keys)case "$cur" in*,)COMPREPLY=( $( compgen -W "${cur}ctrl-" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "ctrl-" -- "$cur" ) );;esac__docker_nospacereturn;;esacreturn 1
}__docker_complete_isolation() {COMPREPLY=( $( compgen -W "default hyperv process" -- "$cur" ) )
}__docker_complete_log_drivers() {COMPREPLY=( $( compgen -W "awslogsetwlogsfluentdgcplogsgelfjournaldjson-filelocallogentriesnonesplunksyslog" -- "$cur" ) )
}__docker_complete_log_options() {# see repository docker/docker.github.io/engine/admin/logging/# really global options, defined in https://github.com/moby/moby/blob/master/daemon/logger/factory.golocal common_options1="max-buffer-size mode"# common options defined in https://github.com/moby/moby/blob/master/daemon/logger/loginfo.go# but not implemented in all log driverslocal common_options2="env env-regex labels"# awslogs does not implement the $common_options2.local awslogs_options="$common_options1 awslogs-create-group awslogs-credentials-endpoint awslogs-datetime-format awslogs-group awslogs-multiline-pattern awslogs-region awslogs-stream tag"local fluentd_options="$common_options1 $common_options2 fluentd-address fluentd-async-connect fluentd-buffer-limit fluentd-retry-wait fluentd-max-retries fluentd-sub-second-precision tag"local gcplogs_options="$common_options1 $common_options2 gcp-log-cmd gcp-meta-id gcp-meta-name gcp-meta-zone gcp-project"local gelf_options="$common_options1 $common_options2 gelf-address gelf-compression-level gelf-compression-type gelf-tcp-max-reconnect gelf-tcp-reconnect-delay tag"local journald_options="$common_options1 $common_options2 tag"local json_file_options="$common_options1 $common_options2 compress max-file max-size"local local_options="$common_options1 compress max-file max-size"local logentries_options="$common_options1 $common_options2 line-only logentries-token tag"local splunk_options="$common_options1 $common_options2 splunk-caname splunk-capath splunk-format splunk-gzip splunk-gzip-level splunk-index splunk-insecureskipverify splunk-source splunk-sourcetype splunk-token splunk-url splunk-verify-connection tag"local syslog_options="$common_options1 $common_options2 syslog-address syslog-facility syslog-format syslog-tls-ca-cert syslog-tls-cert syslog-tls-key syslog-tls-skip-verify tag"local all_options="$fluentd_options $gcplogs_options $gelf_options $journald_options $logentries_options $json_file_options $syslog_options $splunk_options"case $(__docker_value_of_option --log-driver) in'')COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) );;awslogs)COMPREPLY=( $( compgen -W "$awslogs_options" -S = -- "$cur" ) );;fluentd)COMPREPLY=( $( compgen -W "$fluentd_options" -S = -- "$cur" ) );;gcplogs)COMPREPLY=( $( compgen -W "$gcplogs_options" -S = -- "$cur" ) );;gelf)COMPREPLY=( $( compgen -W "$gelf_options" -S = -- "$cur" ) );;journald)COMPREPLY=( $( compgen -W "$journald_options" -S = -- "$cur" ) );;json-file)COMPREPLY=( $( compgen -W "$json_file_options" -S = -- "$cur" ) );;local)COMPREPLY=( $( compgen -W "$local_options" -S = -- "$cur" ) );;logentries)COMPREPLY=( $( compgen -W "$logentries_options" -S = -- "$cur" ) );;syslog)COMPREPLY=( $( compgen -W "$syslog_options" -S = -- "$cur" ) );;splunk)COMPREPLY=( $( compgen -W "$splunk_options" -S = -- "$cur" ) );;*)return;;esac__docker_nospace
}__docker_complete_log_driver_options() {local key=$(__docker_map_key_of_current_option '--log-opt')case "$key" inawslogs-create-group)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;awslogs-credentials-endpoint)COMPREPLY=( $( compgen -W "/" -- "${cur##*=}" ) )__docker_nospacereturn;;compress|fluentd-async-connect)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;fluentd-sub-second-precision)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;gelf-address)COMPREPLY=( $( compgen -W "tcp udp" -S "://" -- "${cur##*=}" ) )__docker_nospacereturn;;gelf-compression-level)COMPREPLY=( $( compgen -W "1 2 3 4 5 6 7 8 9" -- "${cur##*=}" ) )return;;gelf-compression-type)COMPREPLY=( $( compgen -W "gzip none zlib" -- "${cur##*=}" ) )return;;line-only)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;mode)COMPREPLY=( $( compgen -W "blocking non-blocking" -- "${cur##*=}" ) )return;;syslog-address)COMPREPLY=( $( compgen -W "tcp:// tcp+tls:// udp:// unix://" -- "${cur##*=}" ) )__docker_nospace__ltrim_colon_completions "${cur}"return;;syslog-facility)COMPREPLY=( $( compgen -W "authauthprivcrondaemonftpkernlocal0local1local2local3local4local5local6local7lprmailnewssysloguseruucp" -- "${cur##*=}" ) )return;;syslog-format)COMPREPLY=( $( compgen -W "rfc3164 rfc5424 rfc5424micro" -- "${cur##*=}" ) )return;;syslog-tls-ca-cert|syslog-tls-cert|syslog-tls-key)_filedirreturn;;syslog-tls-skip-verify)COMPREPLY=( $( compgen -W "true" -- "${cur##*=}" ) )return;;splunk-url)COMPREPLY=( $( compgen -W "http:// https://" -- "${cur##*=}" ) )__docker_nospace__ltrim_colon_completions "${cur}"return;;splunk-gzip|splunk-insecureskipverify|splunk-verify-connection)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;splunk-format)COMPREPLY=( $( compgen -W "inline json raw" -- "${cur##*=}" ) )return;;esacreturn 1
}__docker_complete_log_levels() {COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) )
}__docker_complete_restart() {case "$prev" in--restart)case "$cur" inon-failure:*);;*)COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") );;esacreturn;;esacreturn 1
}# __docker_complete_signals returns a subset of the available signals that is most likely
# relevant in the context of docker containers
__docker_complete_signals() {local signals=(SIGCONTSIGHUPSIGINTSIGKILLSIGQUITSIGSTOPSIGTERMSIGUSR1SIGUSR2)COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo "$cur" | tr '[:lower:]' '[:upper:]')" ) )
}__docker_complete_stack_orchestrator_options() {case "$prev" in--kubeconfig)_filedirreturn 0;;--namespace)return 0;;--orchestrator)COMPREPLY=( $( compgen -W "all kubernetes swarm" -- "$cur") )return 0;;esacreturn 1
}__docker_complete_user_group() {if [[ $cur == *:* ]] ; thenCOMPREPLY=( $(compgen -g -- "${cur#*:}") )elseCOMPREPLY=( $(compgen -u -S : -- "$cur") )__docker_nospacefi
}_docker_docker() {# global options that may appear after the docker commandlocal boolean_options="$global_boolean_options--help--version -v"case "$prev" in--config)_filedir -dreturn;;--log-level|-l)__docker_complete_log_levelsreturn;;$(__docker_to_extglob "$global_options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )if [ "$cword" -eq "$counter" ]; then__docker_client_is_experimental && commands+=(${experimental_client_commands[*]})__docker_server_is_experimental && commands+=(${experimental_server_commands[*]})COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )fi;;esac
}_docker_attach() {_docker_container_attach
}_docker_build() {_docker_image_build
}_docker_checkpoint() {local subcommands="createlsrm"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_checkpoint_create() {case "$prev" in--checkpoint-dir)_filedir -dreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--checkpoint-dir --help --leave-running" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_runningfi;;esac
}_docker_checkpoint_ls() {case "$prev" in--checkpoint-dir)_filedir -dreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_checkpoint_rm() {case "$prev" in--checkpoint-dir)_filedir -dreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allelif [ "$cword" -eq "$((counter + 1))" ]; thenCOMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) )fi;;esac
}_docker_config() {local subcommands="createinspectlsrm"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_config_create() {case "$prev" in--label|-l)return;;--template-driver)COMPREPLY=( $( compgen -W "golang" -- "$cur" ) )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --label -l --template-driver" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--label|-l|--template-driver')if [ "$cword" -eq "$((counter + 1))" ]; then_filedirfi;;esac
}_docker_config_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) );;*)__docker_complete_configs;;esac
}_docker_config_list() {_docker_config_ls
}_docker_config_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inid)__docker_complete_configs --cur "${cur##*=}" --idreturn;;name)__docker_complete_configs --cur "${cur##*=}" --namereturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format --filter -f --help --quiet -q" -- "$cur" ) );;esac
}_docker_config_remove() {_docker_config_rm
}_docker_config_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_configs;;esac
}_docker_container() {local subcommands="attachcommitcpcreatediffexecexportinspectkilllogslspauseportprunerenamerestartrmrunstartstatsstoptopunpauseupdatewait"local aliases="listps"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_container_attach() {__docker_complete_detach_keys && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--detach-keys --help --no-stdin --sig-proxy=false" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--detach-keys')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_runningfi;;esac
}_docker_container_commit() {case "$prev" in--author|-a|--change|-c|--message|-m)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--author -a --change -c --help --message -m --pause=false -p=false" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allreturnelif [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_images --repo --tagreturnfi;;esac
}_docker_container_cp() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--archive -a --follow-link -L --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; thencase "$cur" in*:)return;;*)# combined container and filename completion_filedirlocal files=( ${COMPREPLY[@]} )__docker_complete_containers_allCOMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )local containers=( ${COMPREPLY[@]} )COMPREPLY=( $( compgen -W "${files[*]} ${containers[*]}" -- "$cur" ) )if [[ "${COMPREPLY[*]}" = *: ]]; then__docker_nospacefireturn;;esacfi(( counter++ ))if [ "$cword" -eq "$counter" ]; thenif [ -e "$prev" ]; then__docker_complete_containers_allCOMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )__docker_nospaceelse_filedirfireturnfi;;esac
}_docker_container_create() {_docker_container_run_and_create
}_docker_container_diff() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_container_exec() {__docker_complete_detach_keys && returncase "$prev" in--env|-e)# we do not append a "=" here because "-e VARNAME" is legal syntax, tooCOMPREPLY=( $( compgen -e -- "$cur" ) )__docker_nospacereturn;;--user|-u)__docker_complete_user_groupreturn;;--workdir|-w)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--detach -d --detach-keys --env -e --help --interactive -i --privileged -t --tty -u --user --workdir -w" -- "$cur" ) );;*)__docker_complete_containers_running;;esac
}_docker_container_export() {case "$prev" in--output|-o)_filedirreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_container_inspect() {_docker_inspect --type container
}_docker_container_kill() {case "$prev" in--signal|-s)__docker_complete_signalsreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --signal -s" -- "$cur" ) );;*)__docker_complete_containers_running;;esac
}_docker_container_logs() {case "$prev" in--since|--tail|--until)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail --timestamps -t --until" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--since|--tail|--until')if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_container_list() {_docker_container_ls
}_docker_container_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inancestor)__docker_complete_images --cur "${cur##*=}" --repo --tag --idreturn;;before)__docker_complete_containers_all --cur "${cur##*=}"return;;expose|publish)return;;id)__docker_complete_containers_all --cur "${cur##*=}" --idreturn;;health)COMPREPLY=( $( compgen -W "healthy starting none unhealthy" -- "${cur##*=}" ) )return;;is-task)COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) )return;;name)__docker_complete_containers_all --cur "${cur##*=}" --namereturn;;network)__docker_complete_networks --cur "${cur##*=}"return;;since)__docker_complete_containers_all --cur "${cur##*=}"return;;status)COMPREPLY=( $( compgen -W "created dead exited paused restarting running removing" -- "${cur##*=}" ) )return;;volume)__docker_complete_volumes --cur "${cur##*=}"return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "ancestor before exited expose health id is-task label name network publish since status volume" -- "$cur" ) )__docker_nospacereturn;;--format|--last|-n)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--all -a --filter -f --format --help --last -n --latest -l --no-trunc --quiet -q --size -s" -- "$cur" ) );;esac
}_docker_container_pause() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_containers_running;;esac
}_docker_container_port() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_container_prune() {case "$prev" in--filter)COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) )__docker_nospacereturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --filter --help" -- "$cur" ) );;esac
}_docker_container_ps() {_docker_container_ls
}_docker_container_rename() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_allfi;;esac
}_docker_container_restart() {case "$prev" in--time|-t)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) );;*)__docker_complete_containers_all;;esac
}_docker_container_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help --link -l --volumes -v" -- "$cur" ) );;*)for arg in "${COMP_WORDS[@]}"; docase "$arg" in--force|-f)__docker_complete_containers_allreturn;;esacdone__docker_complete_containers_removable;;esac
}_docker_container_run() {_docker_container_run_and_create
}# _docker_container_run_and_create is the combined completion for `_docker_container_run`
# and `_docker_container_create`
_docker_container_run_and_create() {local options_with_args="--add-host--attach -a--blkio-weight--blkio-weight-device--cap-add--cap-drop--cgroup-parent--cidfile--cpu-period--cpu-quota--cpu-rt-period--cpu-rt-runtime--cpuset-cpus--cpus--cpuset-mems--cpu-shares -c--device--device-cgroup-rule--device-read-bps--device-read-iops--device-write-bps--device-write-iops--dns--dns-option--dns-search--entrypoint--env -e--env-file--expose--group-add--health-cmd--health-interval--health-retries--health-start-period--health-timeout--hostname -h--ip--ip6--ipc--kernel-memory--label-file--label -l--link--link-local-ip--log-driver--log-opt--mac-address--memory -m--memory-swap--memory-swappiness--memory-reservation--mount--name--network--network-alias--oom-score-adj--pid--pids-limit--publish -p--restart--runtime--security-opt--shm-size--stop-signal--stop-timeout--storage-opt--tmpfs--sysctl--ulimit--user -u--userns--uts--volume-driver--volumes-from--volume -v--workdir -w"__docker_server_os_is windows && options_with_args+="--cpu-count--cpu-percent--io-maxbandwidth--io-maxiops--isolation"__docker_server_is_experimental && options_with_args+="--platform"local boolean_options="--disable-content-trust=false--help--init--interactive -i--no-healthcheck--oom-kill-disable--privileged--publish-all -P--read-only--tty -t"if [ "$command" = "run" ] || [ "$subcommand" = "run" ] ; thenoptions_with_args="$options_with_args--detach-keys"boolean_options="$boolean_options--detach -d--rm--sig-proxy=false"__docker_complete_detach_keys && returnfilocal all_options="$options_with_args $boolean_options"__docker_complete_log_driver_options && return__docker_complete_restart && returnlocal key=$(__docker_map_key_of_current_option '--security-opt')case "$key" inlabel)[[ $cur == *: ]] && returnCOMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "${cur##*=}") )if [ "${COMPREPLY[*]}" != "disable" ] ; then__docker_nospacefireturn;;seccomp)local cur=${cur##*=}_filedirCOMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) )return;;esaccase "$prev" in--add-host)case "$cur" in*:)__docker_complete_resolved_hostnamereturn;;esac;;--attach|-a)COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) )return;;--cap-add)__docker_complete_capabilities_addablereturn;;--cap-drop)__docker_complete_capabilities_droppablereturn;;--cidfile|--env-file|--label-file)_filedirreturn;;--device|--tmpfs|--volume|-v)case "$cur" in*:*)# TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine);;'')COMPREPLY=( $( compgen -W '/' -- "$cur" ) )__docker_nospace;;/*)_filedir__docker_nospace;;esacreturn;;--env|-e)# we do not append a "=" here because "-e VARNAME" is legal syntax, tooCOMPREPLY=( $( compgen -e -- "$cur" ) )__docker_nospacereturn;;--ipc)case "$cur" in*:*)cur="${cur#*:}"__docker_complete_containers_running;;*)COMPREPLY=( $( compgen -W 'none host private shareable container:' -- "$cur" ) )if [ "${COMPREPLY[*]}" = "container:" ]; then__docker_nospacefi;;esacreturn;;--isolation)if __docker_server_os_is windows ; then__docker_complete_isolationreturnfi;;--link)case "$cur" in*:*);;*)__docker_complete_containers_runningCOMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )__docker_nospace;;esacreturn;;--log-driver)__docker_complete_log_driversreturn;;--log-opt)__docker_complete_log_optionsreturn;;--network)case "$cur" incontainer:*)__docker_complete_containers_all --cur "${cur#*:}";;*)COMPREPLY=( $( compgen -W "$(__docker_plugins_bundled --type Network) $(__docker_networks) container:" -- "$cur") )if [ "${COMPREPLY[*]}" = "container:" ] ; then__docker_nospacefi;;esacreturn;;--pid)case "$cur" in*:*)__docker_complete_containers_running --cur "${cur#*:}";;*)COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) )if [ "${COMPREPLY[*]}" = "container:" ]; then__docker_nospacefi;;esacreturn;;--runtime)__docker_complete_runtimesreturn;;--security-opt)COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then__docker_nospacefireturn;;--stop-signal)__docker_complete_signalsreturn;;--storage-opt)COMPREPLY=( $( compgen -W "size" -S = -- "$cur") )__docker_nospacereturn;;--user|-u)__docker_complete_user_groupreturn;;--userns)COMPREPLY=( $( compgen -W "host" -- "$cur" ) )return;;--volume-driver)__docker_complete_plugins_bundled --type Volumereturn;;--volumes-from)__docker_complete_containers_allreturn;;$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )if [ "$cword" -eq "$counter" ]; then__docker_complete_images --repo --tag --idfi;;esac
}_docker_container_start() {__docker_complete_detach_keys && returncase "$prev" in--checkpoint)if __docker_server_is_experimental ; thenreturnfi;;--checkpoint-dir)if __docker_server_is_experimental ; then_filedir -dreturnfi;;esaccase "$cur" in-*)local options="--attach -a --detach-keys --help --interactive -i"__docker_server_is_experimental && options+=" --checkpoint --checkpoint-dir"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)__docker_complete_containers_stopped;;esac
}_docker_container_stats() {case "$prev" in--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--all -a --format --help --no-stream --no-trunc" -- "$cur" ) );;*)__docker_complete_containers_running;;esac
}_docker_container_stop() {case "$prev" in--time|-t)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) );;*)__docker_complete_containers_running;;esac
}_docker_container_top() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_runningfi;;esac
}_docker_container_unpause() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_containers_unpauseablefi;;esac
}_docker_container_update() {local options_with_args="--blkio-weight--cpu-period--cpu-quota--cpu-rt-period--cpu-rt-runtime--cpus--cpuset-cpus--cpuset-mems--cpu-shares -c--kernel-memory--memory -m--memory-reservation--memory-swap--restart"local boolean_options="--help"local all_options="$options_with_args $boolean_options"__docker_complete_restart && returncase "$prev" in$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) );;*)__docker_complete_containers_all;;esac
}_docker_container_wait() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_containers_all;;esac
}_docker_commit() {_docker_container_commit
}_docker_cp() {_docker_container_cp
}_docker_create() {_docker_container_create
}_docker_daemon() {local boolean_options="$global_boolean_options--experimental--help--icc=false--init--ip-forward=false--ip-masq=false--iptables=false--ipv6--live-restore--no-new-privileges--raw-logs--selinux-enabled--userland-proxy=false--version -v"local options_with_args="$global_options_with_args--add-runtime--allow-nondistributable-artifacts--api-cors-header--authorization-plugin--bip--bridge -b--cgroup-parent--cluster-advertise--cluster-store--cluster-store-opt--config-file--containerd--cpu-rt-period--cpu-rt-runtime--data-root--default-address-pool--default-gateway--default-gateway-v6--default-runtime--default-shm-size--default-ulimit--dns--dns-search--dns-opt--exec-opt--exec-root--fixed-cidr--fixed-cidr-v6--group -G--init-path--insecure-registry--ip--label--log-driver--log-opt--max-concurrent-downloads--max-concurrent-uploads--metrics-addr--mtu--network-control-plane-mtu--node-generic-resource--oom-score-adjust--pidfile -p--registry-mirror--seccomp-profile--shutdown-timeout--storage-driver -s--storage-opt--swarm-default-advertise-addr--userland-proxy-path--userns-remap"__docker_complete_log_driver_options && returnkey=$(__docker_map_key_of_current_option '--cluster-store-opt')case "$key" inkv.*file)cur=${cur##*=}_filedirreturn;;esaclocal key=$(__docker_map_key_of_current_option '--storage-opt')case "$key" indm.blkdiscard|dm.override_udev_sync_check|dm.use_deferred_removal|dm.use_deferred_deletion)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;dm.directlvm_device|dm.thinpooldev)cur=${cur##*=}_filedirreturn;;dm.fs)COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur##*=}" ) )return;;dm.libdm_log_level)COMPREPLY=( $( compgen -W "2 3 4 5 6 7" -- "${cur##*=}" ) )return;;esaccase "$prev" in--authorization-plugin)__docker_complete_plugins_bundled --type Authorizationreturn;;--cluster-store)COMPREPLY=( $( compgen -W "consul etcd zk" -S "://" -- "$cur" ) )__docker_nospacereturn;;--cluster-store-opt)COMPREPLY=( $( compgen -W "discovery.heartbeat discovery.ttl kv.cacertfile kv.certfile kv.keyfile kv.path" -S = -- "$cur" ) )__docker_nospacereturn;;--config-file|--containerd|--init-path|--pidfile|-p|--tlscacert|--tlscert|--tlskey|--userland-proxy-path)_filedirreturn;;--exec-root|--data-root)_filedir -dreturn;;--log-driver)__docker_complete_log_driversreturn;;--storage-driver|-s)COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) )return;;--storage-opt)local btrfs_options="btrfs.min_space"local devicemapper_options="dm.basesizedm.blkdiscarddm.blocksizedm.directlvm_devicedm.fsdm.libdm_log_leveldm.loopdatasizedm.loopmetadatasizedm.min_free_spacedm.mkfsargdm.mountoptdm.override_udev_sync_checkdm.thinpooldevdm.thinp_autoextend_percentdm.thinp_autoextend_thresholddm.thinp_metapercentdm.thinp_percentdm.use_deferred_deletiondm.use_deferred_removal"local overlay2_options="overlay2.size"local zfs_options="zfs.fsname"local all_options="$btrfs_options $devicemapper_options $overlay2_options $zfs_options"case $(__docker_value_of_option '--storage-driver|-s') in'')COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) );;btrfs)COMPREPLY=( $( compgen -W "$btrfs_options" -S = -- "$cur" ) );;devicemapper)COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) );;overlay2)COMPREPLY=( $( compgen -W "$overlay2_options" -S = -- "$cur" ) );;zfs)COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) );;*)return;;esac__docker_nospacereturn;;--log-level|-l)__docker_complete_log_levelsreturn;;--log-opt)__docker_complete_log_optionsreturn;;--metrics-addr)__docker_complete_local_ips__docker_append_to_completions ":"__docker_nospacereturn;;--seccomp-profile)_filedir jsonreturn;;--swarm-default-advertise-addr)__docker_complete_local_interfacesreturn;;--userns-remap)__docker_complete_user_groupreturn;;$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) );;esac
}_docker_deploy() {__docker_server_is_experimental && _docker_stack_deploy
}_docker_diff() {_docker_container_diff
}_docker_events() {_docker_system_events
}_docker_exec() {_docker_container_exec
}_docker_export() {_docker_container_export
}_docker_help() {local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; thenCOMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )fi
}_docker_history() {_docker_image_history
}_docker_image() {local subcommands="buildhistoryimportinspectloadlsprunepullpushrmsavetag"local aliases="imageslistremovermi"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_image_build() {local options_with_args="--add-host--build-arg--cache-from--cgroup-parent--cpuset-cpus--cpuset-mems--cpu-shares -c--cpu-period--cpu-quota--file -f--iidfile--label--memory -m--memory-swap--network--shm-size--tag -t--target--ulimit"__docker_server_os_is windows && options_with_args+="--isolation"local boolean_options="--compress--disable-content-trust=false--force-rm--help--no-cache--pull--quiet -q--rm"if __docker_server_is_experimental ; thenoptions_with_args+="--platform"boolean_options+="--squash--stream"filocal all_options="$options_with_args $boolean_options"case "$prev" in--add-host)case "$cur" in*:)__docker_complete_resolved_hostnamereturn;;esac;;--build-arg)COMPREPLY=( $( compgen -e -- "$cur" ) )__docker_nospacereturn;;--cache-from)__docker_complete_images --repo --tag --idreturn;;--file|-f|--iidfile)_filedirreturn;;--isolation)if __docker_server_os_is windows ; then__docker_complete_isolationreturnfi;;--network)case "$cur" incontainer:*)__docker_complete_containers_all --cur "${cur#*:}";;*)COMPREPLY=( $( compgen -W "$(__docker_plugins_bundled --type Network) $(__docker_networks) container:" -- "$cur") )if [ "${COMPREPLY[*]}" = "container:" ] ; then__docker_nospacefi;;esacreturn;;--tag|-t)__docker_complete_images --repo --tagreturn;;--target)local context_pos=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )local context="${words[$context_pos]}"context="${context:-.}"local file="$( __docker_value_of_option '--file|f' )"local default_file="${context%/}/Dockerfile"local dockerfile="${file:-$default_file}"local targets="$( sed -n 's/^FROM .\+ AS \(.\+\)/\1/p' "$dockerfile" 2>/dev/null )"COMPREPLY=( $( compgen -W "$targets" -- "$cur" ) )return;;$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )if [ "$cword" -eq "$counter" ]; then_filedir -dfi;;esac
}_docker_image_history() {case "$prev" in--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format --help --human=false -H=false --no-trunc --quiet -q" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--format')if [ "$cword" -eq "$counter" ]; then__docker_complete_images --force-tag --idfi;;esac
}_docker_image_images() {_docker_image_ls
}_docker_image_import() {case "$prev" in--change|-c|--message|-m|--platform)return;;esaccase "$cur" in-*)local options="--change -c --help --message -m"__docker_server_is_experimental && options+=" --platform"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m')if [ "$cword" -eq "$counter" ]; then_filedirreturnelif [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_images --repo --tagreturnfi;;esac
}_docker_image_inspect() {_docker_inspect --type image
}_docker_image_load() {case "$prev" in--input|-i|"<")_filedirreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --input -i --quiet -q" -- "$cur" ) );;esac
}_docker_image_list() {_docker_image_ls
}_docker_image_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inbefore|since)__docker_complete_images --cur "${cur##*=}" --force-tag --idreturn;;dangling)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;label)return;;reference)__docker_complete_images --cur "${cur##*=}" --repo --tagreturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "before dangling label reference since" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--all -a --digests --filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) );;=)return;;*)__docker_complete_images --repo --tag;;esac
}_docker_image_prune() {case "$prev" in--filter)COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) )__docker_nospacereturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--all -a --force -f --filter --help" -- "$cur" ) );;esac
}_docker_image_pull() {case "$prev" in--platform)return;;esaccase "$cur" in-*)local options="--all-tags -a --disable-content-trust=false --help"__docker_server_is_experimental && options+=" --platform"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag --platform)if [ "$cword" -eq "$counter" ]; thenfor arg in "${COMP_WORDS[@]}"; docase "$arg" in--all-tags|-a)__docker_complete_images --reporeturn;;esacdone__docker_complete_images --repo --tagfi;;esac
}_docker_image_push() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--disable-content-trust=false --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_images --repo --tagfi;;esac
}_docker_image_remove() {_docker_image_rm
}_docker_image_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help --no-prune" -- "$cur" ) );;*)__docker_complete_images --force-tag --id;;esac
}_docker_image_rmi() {_docker_image_rm
}_docker_image_save() {case "$prev" in--output|-o|">")_filedirreturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) );;*)__docker_complete_images --repo --tag --id;;esac
}_docker_image_tag() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_images --force-tag --idreturnelif [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_images --repo --tagreturnfi;;esac
}_docker_images() {_docker_image_ls
}_docker_import() {_docker_image_import
}_docker_info() {_docker_system_info
}_docker_inspect() {local preselected_typelocal typeif [ "$1" = "--type" ] ; thenpreselected_type=yestype="$2"elsetype=$(__docker_value_of_option --type)ficase "$prev" in--format|-f)return;;--type)if [ -z "$preselected_type" ] ; thenCOMPREPLY=( $( compgen -W "container image network node plugin secret service volume" -- "$cur" ) )returnfi;;esaccase "$cur" in-*)local options="--format -f --help --size -s"if [ -z "$preselected_type" ] ; thenoptions+=" --type"fiCOMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)case "$type" in'')COMPREPLY=( $( compgen -W "$(__docker_containers --all)$(__docker_images --force-tag --id)$(__docker_networks)$(__docker_nodes)$(__docker_plugins_installed)$(__docker_secrets)$(__docker_services)$(__docker_volumes)" -- "$cur" ) )__ltrim_colon_completions "$cur";;container)__docker_complete_containers_all;;image)__docker_complete_images --force-tag --id;;network)__docker_complete_networks;;node)__docker_complete_nodes;;plugin)__docker_complete_plugins_installed;;secret)__docker_complete_secrets;;service)__docker_complete_services;;volume)__docker_complete_volumes;;esacesac
}_docker_kill() {_docker_container_kill
}_docker_load() {_docker_image_load
}_docker_login() {case "$prev" in--password|-p|--username|-u)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --password -p --password-stdin --username -u" -- "$cur" ) );;esac
}_docker_logout() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;esac
}_docker_logs() {_docker_container_logs
}_docker_network_connect() {local options_with_args="--alias--ip--ip6--link--link-local-ip"local boolean_options="--help"case "$prev" in--link)case "$cur" in*:*);;*)__docker_complete_containers_runningCOMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )__docker_nospace;;esacreturn;;$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )if [ "$cword" -eq "$counter" ]; then__docker_complete_networkselif [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_containers_allfi;;esac
}_docker_network_create() {case "$prev" in--aux-address|--gateway|--ip-range|--ipam-opt|--ipv6|--opt|-o|--subnet)return;;--config-from)__docker_complete_networksreturn;;--driver|-d)# remove drivers that allow one instance only, add drivers missing in `docker info`__docker_complete_plugins_bundled --type Network --remove host --remove null --add macvlanreturn;;--ipam-driver)COMPREPLY=( $( compgen -W "default" -- "$cur" ) )return;;--label)return;;--scope)COMPREPLY=( $( compgen -W "local swarm" -- "$cur" ) )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--attachable --aux-address --config-from --config-only --driver -d --gateway --help --ingress --internal --ip-range --ipam-driver --ipam-opt --ipv6 --label --opt -o --scope --subnet" -- "$cur" ) );;esac
}_docker_network_disconnect() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_networkselif [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_containers_in_network "$prev"fi;;esac
}_docker_network_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help --verbose" -- "$cur" ) );;*)__docker_complete_networksesac
}_docker_network_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" indriver)__docker_complete_plugins_bundled --cur "${cur##*=}" --type Network --add macvlanreturn;;id)__docker_complete_networks --cur "${cur##*=}" --idreturn;;name)__docker_complete_networks --cur "${cur##*=}" --namereturn;;scope)COMPREPLY=( $( compgen -W "global local swarm" -- "${cur##*=}" ) )return;;type)COMPREPLY=( $( compgen -W "builtin custom" -- "${cur##*=}" ) )return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "driver id label name scope type" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) );;esac
}_docker_network_prune() {case "$prev" in--filter)COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) )__docker_nospacereturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --filter --help" -- "$cur" ) );;esac
}_docker_network_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_networks --filter type=customesac
}_docker_network() {local subcommands="connectcreatedisconnectinspectlsprunerm"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_service() {local subcommands="createinspectlogslsrmrollbackscalepsupdate"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_service_create() {_docker_service_update_and_create
}_docker_service_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) );;*)__docker_complete_servicesesac
}_docker_service_logs() {case "$prev" in--since|--tail)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--details --follow -f --help --no-resolve --no-task-ids --no-trunc --raw --since --tail --timestamps -t" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--since|--tail')if [ "$cword" -eq "$counter" ]; then__docker_complete_services_and_tasksfi;;esac
}_docker_service_list() {_docker_service_ls
}_docker_service_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inid)__docker_complete_services --cur "${cur##*=}" --idreturn;;mode)COMPREPLY=( $( compgen -W "global replicated" -- "${cur##*=}" ) )return;;name)__docker_complete_services --cur "${cur##*=}" --namereturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -W "id label mode name" -S = -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) );;esac
}_docker_service_remove() {_docker_service_rm
}_docker_service_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_servicesesac
}_docker_service_rollback() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--detach -d --help --quit -q" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag )if [ "$cword" -eq "$counter" ]; then__docker_complete_servicesfi;;esac
}_docker_service_scale() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--detach -d --help" -- "$cur" ) );;*)__docker_complete_services__docker_append_to_completions "="__docker_nospace;;esac
}_docker_service_ps() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" indesired-state)COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) )return;;name)__docker_complete_services --cur "${cur##*=}" --namereturn;;node)__docker_complete_nodes --cur "${cur##*=}" --add selfreturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -W "desired-state id name node" -S = -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) );;*)__docker_complete_services;;esac
}_docker_service_update() {_docker_service_update_and_create
}# _docker_service_update_and_create is the combined completion for `docker service create`
# and `docker service update`
_docker_service_update_and_create() {local options_with_args="--endpoint-mode--entrypoint--health-cmd--health-interval--health-retries--health-start-period--health-timeout--hostname--isolation--limit-cpu--limit-memory--log-driver--log-opt--replicas--reserve-cpu--reserve-memory--restart-condition--restart-delay--restart-max-attempts--restart-window--rollback-delay--rollback-failure-action--rollback-max-failure-ratio--rollback-monitor--rollback-order--rollback-parallelism--stop-grace-period--stop-signal--update-delay--update-failure-action--update-max-failure-ratio--update-monitor--update-order--update-parallelism--user -u--workdir -w"__docker_server_os_is windows && options_with_args+="--credential-spec"local boolean_options="--detach -d--help--init--no-healthcheck--read-only--tty -t--with-registry-auth"__docker_complete_log_driver_options && returnif [ "$subcommand" = "create" ] ; thenoptions_with_args="$options_with_args--config--constraint--container-label--dns--dns-option--dns-search--env -e--env-file--generic-resource--group--host--label -l--mode--mount--name--network--placement-pref--publish -p--secret"case "$prev" in--env-file)_filedirreturn;;--mode)COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) )return;;esacfiif [ "$subcommand" = "update" ] ; thenoptions_with_args="$options_with_args--args--config-add--config-rm--constraint-add--constraint-rm--container-label-add--container-label-rm--dns-add--dns-option-add--dns-option-rm--dns-rm--dns-search-add--dns-search-rm--env-add--env-rm--generic-resource-add--generic-resource-rm--group-add--group-rm--host-add--host-rm--image--label-add--label-rm--mount-add--mount-rm--network-add--network-rm--placement-pref-add--placement-pref-rm--publish-add--publish-rm--rollback--secret-add--secret-rm"boolean_options="$boolean_options--force"case "$prev" in--env-rm)COMPREPLY=( $( compgen -e -- "$cur" ) )return;;--image)__docker_complete_images --repo --tag --idreturn;;esacfilocal strategy=$(__docker_map_key_of_current_option '--placement-pref|--placement-pref-add|--placement-pref-rm')case "$strategy" inspread)COMPREPLY=( $( compgen -W "engine.labels node.labels" -S . -- "${cur##*=}" ) )__docker_nospacereturn;;esaccase "$prev" in--config|--config-add|--config-rm)__docker_complete_configsreturn;;--endpoint-mode)COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) )return;;--env|-e|--env-add)# we do not append a "=" here because "-e VARNAME" is legal systax, tooCOMPREPLY=( $( compgen -e -- "$cur" ) )__docker_nospacereturn;;--group|--group-add|--group-rm)COMPREPLY=( $(compgen -g -- "$cur") )return;;--host|--host-add|--host-rm)case "$cur" in*:)__docker_complete_resolved_hostnamereturn;;esac;;--isolation)__docker_complete_isolationreturn;;--log-driver)__docker_complete_log_driversreturn;;--log-opt)__docker_complete_log_optionsreturn;;--network|--network-add|--network-rm)__docker_complete_networksreturn;;--placement-pref|--placement-pref-add|--placement-pref-rm)COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) )__docker_nospacereturn;;--restart-condition)COMPREPLY=( $( compgen -W "any none on-failure" -- "$cur" ) )return;;--rollback-failure-action)COMPREPLY=( $( compgen -W "continue pause" -- "$cur" ) )return;;--secret|--secret-add|--secret-rm)__docker_complete_secretsreturn;;--stop-signal)__docker_complete_signalsreturn;;--update-failure-action)COMPREPLY=( $( compgen -W "continue pause rollback" -- "$cur" ) )return;;--update-order|--rollback-order)COMPREPLY=( $( compgen -W "start-first stop-first" -- "$cur" ) )return;;--user|-u)__docker_complete_user_groupreturn;;$(__docker_to_extglob "$options_with_args") )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )if [ "$subcommand" = "update" ] ; thenif [ "$cword" -eq "$counter" ]; then__docker_complete_servicesfielseif [ "$cword" -eq "$counter" ]; then__docker_complete_images --repo --tag --idfifi;;esac
}_docker_swarm() {local subcommands="cainitjoinjoin-tokenleaveunlockunlock-keyupdate"__docker_subcommands "$subcommands" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_swarm_ca() {case "$prev" in--ca-cert|--ca-key)_filedirreturn;;--cert-expiry|--external-ca)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--ca-cert --ca-key --cert-expiry --detach -d --external-ca --help --quiet -q --rotate" -- "$cur" ) );;esac
}_docker_swarm_init() {case "$prev" in--advertise-addr)if [[ $cur == *: ]] ; thenCOMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )else__docker_complete_local_interfaces__docker_nospacefireturn;;--availability)COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )return;;--cert-expiry|--default-addr-pool|--default-addr-pool-mask-length|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit )return;;--data-path-addr)__docker_complete_local_interfacesreturn;;--listen-addr)if [[ $cur == *: ]] ; thenCOMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )else__docker_complete_local_interfaces --add 0.0.0.0__docker_nospacefireturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --data-path-addr --default-addr-pool --default-addr-pool-mask-length --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) );;esac
}_docker_swarm_join() {case "$prev" in--advertise-addr)if [[ $cur == *: ]] ; thenCOMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )else__docker_complete_local_interfaces__docker_nospacefireturn;;--availability)COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )return;;--data-path-addr)__docker_complete_local_interfacesreturn;;--listen-addr)if [[ $cur == *: ]] ; thenCOMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )else__docker_complete_local_interfaces --add 0.0.0.0__docker_nospacefireturn;;--token)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--advertise-addr --availability --data-path-addr --help --listen-addr --token" -- "$cur" ) );;*:)COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) );;esac
}_docker_swarm_join_token() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag )if [ "$cword" -eq "$counter" ]; thenCOMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) )fi;;esac
}_docker_swarm_leave() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) );;esac
}_docker_swarm_unlock() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;esac
}_docker_swarm_unlock_key() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) );;esac
}_docker_swarm_update() {case "$prev" in--cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--autolock --cert-expiry --dispatcher-heartbeat --external-ca --help --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) );;esac
}_docker_manifest() {local subcommands="annotatecreateinspectpush"__docker_subcommands "$subcommands" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_manifest_annotate() {case "$prev" in--arch)COMPREPLY=( $( compgen -W "386amd64armarm64mips64mips64leppc64les390x" -- "$cur" ) )return;;--os)COMPREPLY=( $( compgen -W "darwindragonflyfreebsdlinuxnetbsdopenbsdplan9solariswindows" -- "$cur" ) )return;;--os-features|--variant)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--arch --help --os --os-features --variant" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag "--arch|--os|--os-features|--variant" )if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_images --force-tag --idfi;;esac
}_docker_manifest_create() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--amend -a --help --insecure" -- "$cur" ) );;*)__docker_complete_images --force-tag --id;;esac
}_docker_manifest_inspect() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --insecure --verbose -v" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag )if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then__docker_complete_images --force-tag --idfi;;esac
}_docker_manifest_push() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --insecure --purge -p" -- "$cur" ) );;*)local counter=$( __docker_pos_first_nonflag )if [ "$cword" -eq "$counter" ]; then__docker_complete_images --force-tag --idfi;;esac
}_docker_node() {local subcommands="demoteinspectlspromotermpsupdate"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_node_demote() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_nodes --filter role=manageresac
}_docker_node_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) );;*)__docker_complete_nodes --add selfesac
}_docker_node_list() {_docker_node_ls
}_docker_node_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inid)__docker_complete_nodes --cur "${cur##*=}" --idreturn;;membership)COMPREPLY=( $( compgen -W "accepted pending" -- "${cur##*=}" ) )return;;name)__docker_complete_nodes --cur "${cur##*=}" --namereturn;;role)COMPREPLY=( $( compgen -W "manager worker" -- "${cur##*=}" ) )return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -W "id label membership name role" -S = -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) );;esac
}_docker_node_promote() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_nodes --filter role=workeresac
}_docker_node_remove() {_docker_node_rm
}_docker_node_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) );;*)__docker_complete_nodesesac
}_docker_node_ps() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" indesired-state)COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) )return;;name)__docker_complete_services --cur "${cur##*=}" --namereturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -W "desired-state id label name" -S = -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) );;*)__docker_complete_nodes --add self;;esac
}_docker_node_update() {case "$prev" in--availability)COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )return;;--role)COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) )return;;--label-add|--label-rm)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--availability --help --label-add --label-rm --role" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--availability|--label-add|--label-rm|--role')if [ "$cword" -eq "$counter" ]; then__docker_complete_nodesfi;;esac
}_docker_pause() {_docker_container_pause
}_docker_plugin() {local subcommands="createdisableenableinspectinstalllspushrmsetupgrade"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_plugin_create() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--compress --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then# reponamereturnelif [ "$cword" -eq "$((counter + 1))" ]; then_filedir -dfi;;esac
}_docker_plugin_disable() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_plugins_installed --filter enabled=truefi;;esac
}_docker_plugin_enable() {case "$prev" in--timeout)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--help --timeout" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--timeout')if [ "$cword" -eq "$counter" ]; then__docker_complete_plugins_installed --filter enabled=falsefi;;esac
}_docker_plugin_inspect() {case "$prev" in--format|f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) );;*)__docker_complete_plugins_installed;;esac
}_docker_plugin_install() {case "$prev" in--alias)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--alias --disable --disable-content-trust=false --grant-all-permissions --help" -- "$cur" ) );;esac
}_docker_plugin_list() {_docker_plugin_ls
}_docker_plugin_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" incapability)COMPREPLY=( $( compgen -W "authz ipamdriver logdriver metricscollector networkdriver volumedriver" -- "${cur##*=}" ) )return;;enabled)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "capability enabled" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) );;esac
}_docker_plugin_push() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_plugins_installedfi;;esac
}_docker_plugin_remove() {_docker_plugin_rm
}_docker_plugin_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) );;*)__docker_complete_plugins_installed;;esac
}_docker_plugin_set() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_plugins_installedfi;;esac
}_docker_plugin_upgrade() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--disable-content-trust --grant-all-permissions --help --skip-remote-check" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_plugins_installed__ltrim_colon_completions "$cur"elif [ "$cword" -eq "$((counter + 1))" ]; thenlocal plugin_images="$(__docker_plugins_installed)"COMPREPLY=( $(compgen -S : -W "${plugin_images%:*}" -- "$cur") )__docker_nospacefi;;esac
}_docker_port() {_docker_container_port
}_docker_ps() {_docker_container_ls
}_docker_pull() {_docker_image_pull
}_docker_push() {_docker_image_push
}_docker_rename() {_docker_container_rename
}_docker_restart() {_docker_container_restart
}_docker_rm() {_docker_container_rm
}_docker_rmi() {_docker_image_rm
}_docker_run() {_docker_container_run
}_docker_save() {_docker_image_save
}_docker_secret() {local subcommands="createinspectlsrm"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_secret_create() {case "$prev" in--driver|-d|--label|-l)return;;--template-driver)COMPREPLY=( $( compgen -W "golang" -- "$cur" ) )return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--driver -d --help --label -l --template-driver" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--driver|-d|--label|-l|--template-driver')if [ "$cword" -eq "$((counter + 1))" ]; then_filedirfi;;esac
}_docker_secret_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) );;*)__docker_complete_secrets;;esac
}_docker_secret_list() {_docker_secret_ls
}_docker_secret_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inid)__docker_complete_secrets --cur "${cur##*=}" --idreturn;;name)__docker_complete_secrets --cur "${cur##*=}" --namereturn;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format --filter -f --help --quiet -q" -- "$cur" ) );;esac
}_docker_secret_remove() {_docker_secret_rm
}_docker_secret_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)__docker_complete_secrets;;esac
}_docker_search() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inis-automated)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;is-official)COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "is-automated is-official stars" -- "$cur" ) )__docker_nospacereturn;;--format|--limit)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --limit --no-trunc" -- "$cur" ) );;esac
}_docker_stack() {local subcommands="deploylspsrmservices"local aliases="downlistremoveup"__docker_complete_stack_orchestrator_options && return__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)local options="--help --orchestrator"__docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_stack_deploy() {__docker_complete_stack_orchestrator_options && returncase "$prev" in--bundle-file)_filedir dabreturn;;--compose-file|-c)_filedir ymlreturn;;--resolve-image)COMPREPLY=( $( compgen -W "always changed never" -- "$cur" ) )return;;esaccase "$cur" in-*)local options="--compose-file -c --help --orchestrator"__docker_server_is_experimental && __docker_stack_orchestrator_is swarm && options+=" --bundle-file"__docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace"__docker_stack_orchestrator_is swarm && options+=" --prune --resolve-image --with-registry-auth"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--bundle-file|--compose-file|-c|--kubeconfig|--namespace|--orchestrator|--resolve-image')if [ "$cword" -eq "$counter" ]; then__docker_complete_stacksfi;;esac
}_docker_stack_down() {_docker_stack_rm
}_docker_stack_list() {_docker_stack_ls
}_docker_stack_ls() {__docker_complete_stack_orchestrator_options && returncase "$prev" in--format)return;;esaccase "$cur" in-*)local options="--format --help --orchestrator"__docker_stack_orchestrator_is kubernetes && options+=" --all-namespaces --kubeconfig --namespace"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;esac
}_docker_stack_ps() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" indesired-state)COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) )return;;id)__docker_complete_stacks --cur "${cur##*=}" --idreturn;;name)__docker_complete_stacks --cur "${cur##*=}" --namereturn;;esac__docker_complete_stack_orchestrator_options && returncase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "id name desired-state" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)local options="--filter -f --format --help --no-resolve --no-trunc --orchestrator --quiet -q"__docker_stack_orchestrator_is kubernetes && options+=" --all-namespaces --kubeconfig --namespace"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--all-namespaces|--filter|-f|--format|--kubeconfig|--namespace')if [ "$cword" -eq "$counter" ]; then__docker_complete_stacksfi;;esac
}_docker_stack_remove() {_docker_stack_rm
}_docker_stack_rm() {__docker_complete_stack_orchestrator_options && returncase "$cur" in-*)local options="--help --orchestrator"__docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)__docker_complete_stacks;;esac
}_docker_stack_services() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" inid)__docker_complete_services --cur "${cur##*=}" --idreturn;;label)return;;name)__docker_complete_services --cur "${cur##*=}" --namereturn;;esac__docker_complete_stack_orchestrator_options && returncase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)local options="--filter -f --format --help --orchestrator --quiet -q"__docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag '--filter|-f|--format|--kubeconfig|--namespace|--orchestrator')if [ "$cword" -eq "$counter" ]; then__docker_complete_stacksfi;;esac
}_docker_stack_up() {_docker_stack_deploy
}_docker_start() {_docker_container_start
}_docker_stats() {_docker_container_stats
}_docker_stop() {_docker_container_stop
}_docker_system() {local subcommands="dfeventsinfoprune"__docker_subcommands "$subcommands" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_system_df() {case "$prev" in--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format --help --verbose -v" -- "$cur" ) );;esac
}_docker_system_events() {local key=$(__docker_map_key_of_current_option '-f|--filter')case "$key" incontainer)__docker_complete_containers_all --cur "${cur##*=}"return;;daemon)local name=$(__docker_q info | sed -n 's/^\(ID\|Name\): //p')COMPREPLY=( $( compgen -W "$name" -- "${cur##*=}" ) )return;;event)COMPREPLY=( $( compgen -W "attachcommitconnectcopycreatedeletedestroydetachdiedisabledisconnectenableexec_createexec_detachexec_dieexec_startexporthealth_statusimportinstallkillloadmountoompausepullpushreloadremoverenameresizerestartsavestartstoptagtopunmountunpauseuntagupdate" -- "${cur##*=}" ) )return;;image)__docker_complete_images --cur "${cur##*=}" --repo --tagreturn;;network)__docker_complete_networks --cur "${cur##*=}"return;;node)__docker_complete_nodes --cur "${cur##*=}"return;;scope)COMPREPLY=( $( compgen -W "local swarm" -- "${cur##*=}" ) )return;;type)COMPREPLY=( $( compgen -W "config container daemon image network plugin secret service volume" -- "${cur##*=}" ) )return;;volume)__docker_complete_volumes --cur "${cur##*=}"return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "container daemon event image label network node scope type volume" -- "$cur" ) )__docker_nospacereturn;;--since|--until)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --help --since --until --format" -- "$cur" ) );;esac
}_docker_system_info() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) );;esac
}_docker_system_prune() {case "$prev" in--filter)COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) )__docker_nospacereturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--all -a --force -f --filter --help --volumes" -- "$cur" ) );;esac
}_docker_tag() {_docker_image_tag
}_docker_trust() {local subcommands="inspectrevokesign"__docker_subcommands "$subcommands" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_trust_inspect() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --pretty" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_images --repo --tagfi;;esac
}_docker_trust_revoke() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --yes -y" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_images --repo --tagfi;;esac
}_docker_trust_sign() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--help --local" -- "$cur" ) );;*)local counter=$(__docker_pos_first_nonflag)if [ "$cword" -eq "$counter" ]; then__docker_complete_images --force-tag --idfi;;esac
}_docker_unpause() {_docker_container_unpause
}_docker_update() {_docker_container_update
}_docker_top() {_docker_container_top
}_docker_version() {__docker_complete_stack_orchestrator_options && returncase "$prev" in--format|-f)return;;esaccase "$cur" in-*)local options="--format -f --help"__docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig"COMPREPLY=( $( compgen -W "$options" -- "$cur" ) );;esac
}_docker_volume_create() {case "$prev" in--driver|-d)__docker_complete_plugins_bundled --type Volumereturn;;--label|--opt|-o)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--driver -d --help --label --opt -o" -- "$cur" ) );;esac
}_docker_volume_inspect() {case "$prev" in--format|-f)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) );;*)__docker_complete_volumes;;esac
}_docker_volume_list() {_docker_volume_ls
}_docker_volume_ls() {local key=$(__docker_map_key_of_current_option '--filter|-f')case "$key" indangling)COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) )return;;driver)__docker_complete_plugins_bundled --cur "${cur##*=}" --type Volumereturn;;name)__docker_complete_volumes --cur "${cur##*=}"return;;esaccase "$prev" in--filter|-f)COMPREPLY=( $( compgen -S = -W "dangling driver label name" -- "$cur" ) )__docker_nospacereturn;;--format)return;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) );;esac
}_docker_volume_prune() {case "$prev" in--filter)COMPREPLY=( $( compgen -W "label label!" -S = -- "$cur" ) )__docker_nospacereturn;;esaccase "$cur" in-*)COMPREPLY=( $( compgen -W "--filter --force -f --help" -- "$cur" ) );;esac
}_docker_volume_remove() {_docker_volume_rm
}_docker_volume_rm() {case "$cur" in-*)COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) );;*)__docker_complete_volumes;;esac
}_docker_volume() {local subcommands="createinspectlsprunerm"local aliases="listremove"__docker_subcommands "$subcommands $aliases" && returncase "$cur" in-*)COMPREPLY=( $( compgen -W "--help" -- "$cur" ) );;*)COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) );;esac
}_docker_wait() {_docker_container_wait
}_docker() {local previous_extglob_setting=$(shopt -p extglob)shopt -s extgloblocal management_commands=(configcontainerimagenetworknodepluginsecretservicestackswarmsystemtrustvolume)local top_level_commands=(buildloginlogoutrunsearchversion)local legacy_commands=(attachcommitcpcreatediffeventsexecexporthistoryimagesimportinfoinspectkillloadlogspauseportpspullpushrenamerestartrmrmisavestartstatsstoptagtopunpauseupdatewait)local experimental_client_commands=(manifest)local experimental_server_commands=(checkpointdeploy)local commands=(${management_commands[*]} ${top_level_commands[*]})[ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]})# These options are valid as global options for all client commands# and valid as command options for `docker daemon`local global_boolean_options="--debug -D--tls--tlsverify"local global_options_with_args="--config--host -H--log-level -l--tlscacert--tlscert--tlskey"# variables to cache server info, populated on demand for performance reasonslocal info_fetched server_experimental server_os# variables to cache client info, populated on demand for performance reasonslocal client_experimental stack_orchestrator_is_kubernetes stack_orchestrator_is_swarmlocal host configCOMPREPLY=()local cur prev words cword_get_comp_words_by_ref -n : cur prev words cwordlocal command='docker' command_pos=0 subcommand_poslocal counter=1while [ "$counter" -lt "$cword" ]; docase "${words[$counter]}" indocker)return 0;;# save host so that completion can use custom daemon--host|-H)(( counter++ ))host="${words[$counter]}";;# save config so that completion can use custom configuration directories--config)(( counter++ ))config="${words[$counter]}";;$(__docker_to_extglob "$global_options_with_args") )(( counter++ ));;-*);;=)(( counter++ ));;*)command="${words[$counter]}"command_pos=$counterbreak;;esac(( counter++ ))donelocal binary="${words[0]}"if [[ $binary == ?(*/)dockerd ]] ; then# for the dockerd binary, we reuse completion of `docker daemon`.# dockerd does not have subcommands and global options.command=daemoncommand_pos=0filocal completions_func=_docker_${command//-/_}declare -F $completions_func >/dev/null && $completions_funceval "$previous_extglob_setting"return 0
}eval "$__docker_previous_extglob_setting"
unset __docker_previous_extglob_settingcomplete -F _docker docker docker.exe dockerd dockerd.exe
相关文章:
linux下二进制安装docker最新版docker-24.0.6
一.基础环境 本次实操是公司技术培训下基于centos7.9操作系统安装docker最新版docker-24.0.6,下载地址是:https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz 二. 下载Docker压缩包 mkdir -p /opt/docker-soft cd /opt/docker…...
计算机视觉 01(介绍)
一、深度学习 1.1 人工智能 1.2 人工智能,机器学习和深度学习的关系 机器学习是实现人工智能的一种途径,深度学习是机器学习的一个子集,也就是说深度学习是实现机器学习的一种方法。与机器学习算法的主要区别如下图所示[参考:黑…...
Java下部笔记
目录 一.双列集合 1.Map 2.Map的遍历方式 3.可变参数 4.Collection中的默认方法 5.不可变集合(map不会) 二.Stream流 1.获取stream流 2.中间方法 3.stream流的收集操作 4.方法引用 1.引用静态方法 2.引用成员方法 3.引用构造方法 4.使用类…...
链表基本操作
单链表简介 单链表结构 头指针是指向链表中第一个结点的指针 首元结点是指链表中存储第一个数据元素a1的结点 头结点是在链表的首元结点之前附设的一个结点;数据域内只放空表标志和表长等信息 单链表存储结构定义: typedef struct Lnode { ElemTyp…...
Linux学习笔记-Ubuntu系统下配置用户ssh只能访问git仓库
目录 一、基本信息1.1 系统信息1.2 git版本[^1]1.2.1 服务器端git版本1.2.2 客户端TortoiseGit版本1.2.3 客户端Git for windows版本 二、创建git用户和群组[^2]2.1 使用groupadd创建群组2.2 创建git用户2.2.1 使用useradd创建git用户2.2.2 配置新建的git用户ssh免密访问 2.3 创…...
央媒发稿不能改?媒体发布新闻稿有哪些注意点
传媒如春雨,润物细无声,大家好,我是51媒体网胡老师。 “央媒发稿不能改”是媒体行业和新闻传播领域的普遍理解。央媒,即中央主要媒体,是权威性的新闻源,当这些媒体发布新闻稿或报道时,其他省、…...
计算机竞赛 深度学习 opencv python 公式识别(图像识别 机器视觉)
文章目录 0 前言1 课题说明2 效果展示3 具体实现4 关键代码实现5 算法综合效果6 最后 0 前言 🔥 优质竞赛项目系列,今天要分享的是 🚩 基于深度学习的数学公式识别算法实现 该项目较为新颖,适合作为竞赛课题方向,学…...
KPM算法
概念 KMP(Knuth–Morris–Pratt)算法是一种字符串匹配算法,用于在一个主文本字符串中查找一个模式字符串的出现位置。KMP算法通过利用模式字符串中的重复性,避免无意义的字符比较,从而提高效率。 KMP算法的核心思想是…...
全流程GMS地下水数值模拟及溶质(包含反应性溶质)运移模拟技术教程
详情点击公众号链接:全流程GMS地下水数值模拟及溶质(包含反应性溶质)运移模拟技术教程 前言 GMS三维地质结构建模 GMS地下水流数值模拟 GMS溶质运移数值模拟与反应性溶质运移模 详情 1.GMS的建模数据的收集、数据预处理以及格式等ÿ…...
GE D20 EME 10BASE-T电源模块产品特点
GE D20 EME 10BASE-T 电源模块通常是工业自动化和控制系统中的一个关键组件,用于为系统中的各种设备和模块提供电源。以下是可能包括在 GE D20 EME 10BASE-T 电源模块中的一些产品特点: 电源输出:D20 EME 模块通常提供一个或多个电源输出通道…...
游戏工作时d3dcompiler_47.dll缺失怎么修复?5种修复方法分享
游戏提示 d3dcompiler_47.dll 缺失的困扰,相信许多玩家都遇到过。这种情况通常会导致游戏无法正常运行,给玩家带来很大的不便。那么,该如何解决这个问题呢?小编将为大家介绍几种解决方法,希望对大家有所帮助。 首先&am…...
关于激光探测器光斑质心算法在FPGA硬件的设计
目录 0引言 1CCD采集图像质心算法 2基于FPGA的图像质心算法 3仿真结果与分析 4结论 0引言 在一些姿态检测的实际应用中,需要在被测对象上安装激光探测器[1],利用CCD相机捕捉激光光斑来检测观测对象的实际情况,光斑图像质心坐标的提取是图…...
理清SpringBoot CURD处理逻辑、顺序
💗wei_shuo的个人主页 💫wei_shuo的学习社区 🌐Hello World ! 理清SpringBoot CURD处理逻辑、顺序 Controller(控制器): 控制器接收来自客户端的请求,并负责处理请求的路由和参数解析…...
缓存读写淘汰算法W-TinyLFU算法
在W-TinyLFU中,每个缓存项都会被赋予一个权重。这个权重可以表示缓存项的大小、使用频率、是否是热数据等因素。每次需要淘汰缓存时,W-TinyLFU会选择小于一定阈值的权重的缓存项进行淘汰,以避免淘汰热数据。 另外,W-TinyLFU也会根…...
C++中的 throw详解
在《C++异常处理》一节中,我们讲到了 C++ 异常处理的流程,具体为: 抛出(Throw)--> 检测(Try) --> 捕获(Catch) 异常必须显式地抛出,才能被检测和捕获到;如果没有显式的抛出,即使有异常也检测不到。在 C++ 中,我们使用 throw 关键字来显式地抛出异常,它的用…...
vue 封装Table组件
基于element-plus UI 框架封装一个table组件 在项目目录下的components新建一个Table.vue <template><section class"wrap"><el-tableref"table":data"tableData" v-loading"loading" style"width: 100%":…...
MySQL主从复制错误
当在MySQL的多线程复制中遇到错误时,你可能会看到上述的错误信息。错误的核心在于从服务器上的工作线程在尝试执行一个特定的事务时遇到了问题。 为了解决这个问题,你可以采取以下步骤: 查看MySQL的错误日志:错误日志可能会提供更…...
Redis群集
目录 1、redis群集三种模式 2、Redis 主从复制 2.1 主从复制的作用 2.2 主从复制流程 2.3 搭建Redis 主从复制 3、Redis 哨兵模式 3.1 哨兵模式的作用 3.2 故障转移机制 3.3 主节点的选举 4、Redis 群集模式 4.1 集群的作用 4.2 Redis集群的数据分片 4.3 搭建Redis…...
Spring AOP以及统一处理
一.Spring AOP 1.什么是Spring AOP AOP(Aspect Oriented Programming):面向切面编程,它是一种思想,它是对某一类事情的集中处理。 2.AOP的作用 想象一个场景,我们在做后台系统时,除了登录…...
vue2markdown转思维导图
官网 http://markmap.js.org 按照官网安装markmap-lib,markmap-view两个依赖外,还需要安装markmap-common 如果报错提示vuePdfNoSss相关问题,需要安装vue-pdf 如果报错can’t import the named export ‘xxx’ from non EcmaScript module,需…...
docker下redis备份文件dump.rdb获取
1.查看镜像 docker ps -a 2.进入redis客户端 docker exec -it redis redis-cli 3.保存备份文件 save 4.查看文件存放位置 CONFIG GET dir 5.将docker中文件拷出 docker cp id或name:容器中文件的路径 目标目录地址...
二十一、MySQL(多表)内连接、外连接、自连接实现
1、多表查询 (1)基础概念: (2)多表查询的分类: 2、内连接 (1)基础概念: (2)隐式内连接: 基础语法: select 表1.name,…...
Zookeeper运维
我是一个目录 1. 参数说明2. Zookeeper优化建议3. Zookeeper性能查看4. 建议 1. 参数说明 工作节点瞬间压力大,导致和集群通信出现延迟,被踢出节点,瞬间释放的连接立即又连接到另外节点,最终集群挂掉。加了一些延迟配置后…...
uniapp 点击事件-防重复点击
uniapp 点击事件-防重复点击 1、common文件并创建anti-shake.js文件 // 防止处理多次点击 function noMoreClicks(methods, info) {// methods是需要点击后需要执行的函数, info是点击需要传的参数let that this;if (that.noClick) {// 第一次点击that.noClick f…...
推进“数智+数治”,中期科技智慧公厕驱动城市公厕更新升级发展
随着城市化的快速发展和人口的不断增加,公共厕所这一基础设施的更新升级成为了亟待解决的问题。过去的传统公厕往往存在着环境脏乱差、无法保证使用者的舒适度等诸多问题。而智慧公厕则能够通过互联网和物联网的技术手段,实现智能化的运行管理࿰…...
4、模板(二叉树,红黑树,STL的实现)
1. 泛型编程 2. 模板:参数类型化 3. 模板分类 3.1 函数模板 概念 实例化:隐式实例化,显式实例化 3.2 类模板 4. 在模板参数列表中:class和typename 5.模板参数列表:template <class T , size_t N> 类型参数&#x…...
了解JVM
一.了解JVM 1.1什么是JVM JVM是Java Virtual Machine(Java虚拟机)的缩写,是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟计算机功能来实现的,JVM屏蔽了与具体操作系统平台相关的信息,Java程序只…...
vue2实现组织机构树
参考大佬文章:https://www.cnblogs.com/10ve/p/12573772.html 【vue——实现组织架构图(vue-org-tree)——技能提升 - CSDN App】http://t.csdn.cn/Mpe4B...
JS中BigInt的使用
JS中BigInt的使用 BigInt是一种内置对象,它提供了一种方法来表示大于2^53 - 1的整数,通俗来讲就是提供了一种可以表示任意大整数的方法,当我们使用Number来表示一个超过了2 ^53 - 1的整数的时候,会出错。所以此时我们需要使用Big…...
你的第1个 Unity 游戏!!!
简介 首先新建一个方块添加重力!!!总结首先 首先,你要先打开 U n i t y Unity Unity...
长基建站/2024年3月新冠肺炎
04 ssh 参考自:Linux基础课。 4.1 ssh 基本用法 远程登录服务器: ssh userhostnameuser: 用户名 hostname: IP地址或域名 第一次登录时会提示: The authenticity of host 123.57.47.211 (123.57.47.211) cant be established. ECDSA k…...
wordpress相册插件下载/网络营销运营
本文主要是MySQL知识点的一些复盘,在面试中也被问道了。 第一篇见下链接: MySQL知识面试复盘(一) 一、什么是数据库连接池?为什么需要建立连接池? (一)什么是数据库连接池&#x…...
自主网站/北京网站建设公司哪家好
前言:仅个人小记。 正文 由于 rapidjson是 “header-only”的C库,故而直接将头文件目录拷贝到系统目录或者指定目录即可完成安装。 参考材料: rapidjson代码仓库 https://github.com/Tencent/rapidjson rapidjson 文档 https://rapidjson.…...
洛阳网站建设联系方式/淘宝指数查询
Attribute selectors are a particularly helpful subset of CSS selectors. They allow us to specify an element by one of its HTML attributes, such as a links title attribute or an images alt attribute. 属性选择器是一个相当有用css选择器的子集。 它允许我们通过…...
虚拟机怎么做多个网站/网站免费搭建平台
在拍摄人像照片时,由于受环境色的影响,人的皮肤上通常有部分区域产生偏色(Color Cast)现象。比如,在绿草地或绿色植物附近拍摄时,部分皮肤受反射的绿光的影响而染上难看的绿色。对于黄种人来说,…...
做网站的目的/精准客源app
我正在尝试创建一个函数来捕获以规范形式(XXX)XXX-XXX或XXX-XXX-XXXX写入的电话号码,并附加条件。这是我的方法def parse_phone2(s):phone_number re.compile(r^\s*\(? # Begining of string, Ignore leading spaces([0-9]{3}) # Area code\)?\s*|-? # Match 0 …...