Browse code

update docker to 17.06.0-ce

Change-Id: I2d7c281448a855ba21c0b38f8ae4221eb3d3079c
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3283
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

Bo Gan authored on 2017/07/15 13:00:04
Showing 7 changed files
1 1
deleted file mode 100644
... ...
@@ -1,2978 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# bash completion file for core docker commands
4
-#
5
-# This script provides completion of:
6
-#  - commands and their options
7
-#  - container ids and names
8
-#  - image repos and tags
9
-#  - filepaths
10
-#
11
-# To enable the completions either:
12
-#  - place this file in /etc/bash_completion.d
13
-#  or
14
-#  - copy this file to e.g. ~/.docker-completion.sh and add the line
15
-#    below to your .bashrc after bash completion features are loaded
16
-#    . ~/.docker-completion.sh
17
-#
18
-# Configuration:
19
-#
20
-# For several commands, the amount of completions can be configured by
21
-# setting environment variables.
22
-#
23
-# DOCKER_COMPLETION_SHOW_NETWORK_IDS
24
-# DOCKER_COMPLETION_SHOW_NODE_IDS
25
-# DOCKER_COMPLETION_SHOW_SERVICE_IDS
26
-#   "no"  - Show names only (default)
27
-#   "yes" - Show names and ids
28
-#
29
-# You can tailor completion for the "events", "history", "inspect", "run",
30
-# "rmi" and "save" commands by settings the following environment
31
-# variables:
32
-#
33
-# DOCKER_COMPLETION_SHOW_IMAGE_IDS
34
-#   "none" - Show names only (default)
35
-#   "non-intermediate" - Show names and ids, but omit intermediate image IDs
36
-#   "all" - Show names and ids, including intermediate image IDs
37
-#
38
-# DOCKER_COMPLETION_SHOW_TAGS
39
-#   "yes" - include tags in completion options (default)
40
-#   "no"  - don't include tags in completion options
41
-
42
-#
43
-# Note:
44
-# Currently, the completions will not work if the docker daemon is not
45
-# bound to the default communication port/socket
46
-# If the docker daemon is using a unix socket for communication your user
47
-# must have access to the socket for the completions to function correctly
48
-#
49
-# Note for developers:
50
-# Please arrange options sorted alphabetically by long name with the short
51
-# options immediately following their corresponding long form.
52
-# This order should be applied to lists, alternatives and code blocks.
53
-
54
-__docker_previous_extglob_setting=$(shopt -p extglob)
55
-shopt -s extglob
56
-
57
-__docker_q() {
58
-	docker ${host:+-H "$host"} ${config:+--config "$config"} 2>/dev/null "$@"
59
-}
60
-
61
-__docker_complete_containers_all() {
62
-	local IFS=$'\n'
63
-	local containers=( $(__docker_q ps -aq --no-trunc) )
64
-	if [ "$1" ]; then
65
-		containers=( $(__docker_q inspect --format "{{if $1}}{{.Id}}{{end}}" "${containers[@]}") )
66
-	fi
67
-	local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") )
68
-	names=( "${names[@]#/}" ) # trim off the leading "/" from the container names
69
-	unset IFS
70
-	COMPREPLY=( $(compgen -W "${names[*]} ${containers[*]}" -- "$cur") )
71
-}
72
-
73
-__docker_complete_containers_running() {
74
-	__docker_complete_containers_all '.State.Running'
75
-}
76
-
77
-__docker_complete_containers_stopped() {
78
-	__docker_complete_containers_all 'not .State.Running'
79
-}
80
-
81
-__docker_complete_containers_pauseable() {
82
-	__docker_complete_containers_all 'and .State.Running (not .State.Paused)'
83
-}
84
-
85
-__docker_complete_containers_unpauseable() {
86
-	__docker_complete_containers_all '.State.Paused'
87
-}
88
-
89
-__docker_complete_container_names() {
90
-	local containers=( $(__docker_q ps -aq --no-trunc) )
91
-	local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") )
92
-	names=( "${names[@]#/}" ) # trim off the leading "/" from the container names
93
-	COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") )
94
-}
95
-
96
-__docker_complete_container_ids() {
97
-	local containers=( $(__docker_q ps -aq) )
98
-	COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
99
-}
100
-
101
-__docker_complete_images() {
102
-	local images_args=""
103
-
104
-	case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in
105
-		all)
106
-			images_args="--no-trunc -a"
107
-			;;
108
-		non-intermediate)
109
-			images_args="--no-trunc"
110
-			;;
111
-	esac
112
-
113
-	local repo_print_command
114
-	if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; then
115
-		repo_print_command='print $1; print $1":"$2'
116
-	else
117
-		repo_print_command='print $1'
118
-	fi
119
-
120
-	local awk_script
121
-	case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in
122
-		all|non-intermediate)
123
-			awk_script='NR>1 { print $3; if ($1 != "<none>") { '"$repo_print_command"' } }'
124
-			;;
125
-		none|*)
126
-			awk_script='NR>1 && $1 != "<none>" { '"$repo_print_command"' }'
127
-			;;
128
-	esac
129
-
130
-	local images=$(__docker_q images $images_args | awk "$awk_script")
131
-	COMPREPLY=( $(compgen -W "$images" -- "$cur") )
132
-	__ltrim_colon_completions "$cur"
133
-}
134
-
135
-__docker_complete_image_repos() {
136
-	local repos="$(__docker_q images | awk 'NR>1 && $1 != "<none>" { print $1 }')"
137
-	COMPREPLY=( $(compgen -W "$repos" -- "$cur") )
138
-}
139
-
140
-__docker_complete_image_repos_and_tags() {
141
-	local reposAndTags="$(__docker_q images | awk 'NR>1 && $1 != "<none>" { print $1; print $1":"$2 }')"
142
-	COMPREPLY=( $(compgen -W "$reposAndTags" -- "$cur") )
143
-	__ltrim_colon_completions "$cur"
144
-}
145
-
146
-__docker_complete_containers_and_images() {
147
-	__docker_complete_containers_all
148
-	local containers=( "${COMPREPLY[@]}" )
149
-	__docker_complete_images
150
-	COMPREPLY+=( "${containers[@]}" )
151
-}
152
-
153
-# Returns the names and optionally IDs of networks.
154
-# The selection can be narrowed by an optional filter parameter, e.g. 'type=custom'
155
-__docker_networks() {
156
-	local filter="$1"
157
-	# By default, only network names are completed.
158
-	# Set DOCKER_COMPLETION_SHOW_NETWORK_IDS=yes to also complete network IDs.
159
-	local fields='$2'
160
-	[ "${DOCKER_COMPLETION_SHOW_NETWORK_IDS}" = yes ] && fields='$1,$2'
161
-	__docker_q network ls --no-trunc ${filter:+-f "$filter"} | awk "NR>1 {print $fields}"
162
-	#__docker_q network ls --no-trunc | awk "NR>1 {print $fields}"
163
-}
164
-
165
-__docker_complete_networks() {
166
-	COMPREPLY=( $(compgen -W "$(__docker_networks $@)" -- "$cur") )
167
-}
168
-
169
-__docker_complete_network_ids() {
170
-	COMPREPLY=( $(compgen -W "$(__docker_q network ls -q --no-trunc)" -- "$cur") )
171
-}
172
-
173
-__docker_complete_network_names() {
174
-	COMPREPLY=( $(compgen -W "$(__docker_q network ls | awk 'NR>1 {print $2}')" -- "$cur") )
175
-}
176
-
177
-__docker_complete_containers_in_network() {
178
-	local containers=$(__docker_q network inspect -f '{{range $i, $c := .Containers}}{{$i}} {{$c.Name}} {{end}}' "$1")
179
-	COMPREPLY=( $(compgen -W "$containers" -- "$cur") )
180
-}
181
-
182
-__docker_complete_volumes() {
183
-	COMPREPLY=( $(compgen -W "$(__docker_q volume ls -q)" -- "$cur") )
184
-}
185
-
186
-__docker_plugins() {
187
-	__docker_q info | sed -n "/^Plugins/,/^[^ ]/s/ $1: //p"
188
-}
189
-
190
-__docker_complete_plugins() {
191
-	COMPREPLY=( $(compgen -W "$(__docker_plugins $1)" -- "$cur") )
192
-}
193
-
194
-__docker_runtimes() {
195
-	__docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p'
196
-}
197
-
198
-__docker_complete_runtimes() {
199
-	COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
200
-}
201
-
202
-# Returns a list of all nodes. Additional arguments to `docker node`
203
-# may be specified in order to filter the node list, e.g.
204
-# `__docker_nodes --filter role=manager`
205
-# By default, only node names are completed.
206
-# Set DOCKER_COMPLETION_SHOW_NODE_IDS=yes to also complete node IDs.
207
-# An optional first argument `--id|--name` may be used to limit
208
-# the output to the IDs or names of matching nodes. This setting takes
209
-# precedence over the environment setting.
210
-__docker_nodes() {
211
-	local fields='$2'  # default: node name only
212
-	[ "${DOCKER_COMPLETION_SHOW_NODE_IDS}" = yes ] && fields='$1,$2' # ID and name
213
-
214
-	if [ "$1" = "--id" ] ; then
215
-		fields='$1' # IDs only
216
-		shift
217
-	elif [ "$1" = "--name" ] ; then
218
-		fields='$2' # names only
219
-		shift
220
-	fi
221
-	__docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}"
222
-}
223
-
224
-# Applies completion of nodes based on the current value of `$cur` or
225
-# the value of the optional first argument `--cur`, if given.
226
-# Additional filters may be appended, see `__docker_nodes`.
227
-__docker_complete_nodes() {
228
-	local current=$cur
229
-	if [ "$1" = "--cur" ] ; then
230
-		current="$2"
231
-		shift 2
232
-	fi
233
-	COMPREPLY=( $(compgen -W "$(__docker_nodes "$@")" -- "$current") )
234
-}
235
-
236
-__docker_complete_nodes_plus_self() {
237
-	__docker_complete_nodes "$@"
238
-	COMPREPLY+=( self )
239
-}
240
-
241
-# Returns a list of all services. Additional arguments to `docker service ls`
242
-# may be specified in order to filter the service list, e.g.
243
-# `__docker_services --filter name=xxx`
244
-# By default, only node names are completed.
245
-# Set DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes to also complete service IDs.
246
-# An optional first argument `--id|--name` may be used to limit
247
-# the output to the IDs or names of matching services. This setting takes
248
-# precedence over the environment setting.
249
-__docker_services() {
250
-	local fields='$2'  # default: service name only
251
-	[ "${DOCKER_COMPLETION_SHOW_SERVICE_IDS}" = yes ] && fields='$1,$2' # ID & name
252
-
253
-	if [ "$1" = "--id" ] ; then
254
-		fields='$1' # IDs only
255
-		shift
256
-	elif [ "$1" = "--name" ] ; then
257
-		fields='$2' # names only
258
-		shift
259
-	fi
260
-        __docker_q service ls "$@" | awk "NR>1 {print $fields}"
261
-}
262
-
263
-# Applies completion of services based on the current value of `$cur` or
264
-# the value of the optional first argument `--cur`, if given.
265
-# Additional filters may be appended, see `__docker_services`.
266
-__docker_complete_services() {
267
-	local current=$cur
268
-	if [ "$1" = "--cur" ] ; then
269
-		current="$2"
270
-		shift 2
271
-	fi
272
-	COMPREPLY=( $(compgen -W "$(__docker_services "$@")" -- "$current") )
273
-}
274
-
275
-# Appends the word passed as an argument to every word in `$COMPREPLY`.
276
-# Normally you do this with `compgen -S`. This function exists so that you can use
277
-# the __docker_complete_XXX functions in cases where you need a suffix.
278
-__docker_append_to_completions() {
279
-	COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
280
-}
281
-
282
-# Finds the position of the first word that is neither option nor an option's argument.
283
-# If there are options that require arguments, you should pass a glob describing those
284
-# options, e.g. "--option1|-o|--option2"
285
-# Use this function to restrict completions to exact positions after the argument list.
286
-__docker_pos_first_nonflag() {
287
-	local argument_flags=$1
288
-
289
-	local counter=$((${subcommand_pos:-${command_pos}} + 1))
290
-	while [ $counter -le $cword ]; do
291
-		if [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then
292
-			(( counter++ ))
293
-			# eat "=" in case of --option=arg syntax
294
-			[ "${words[$counter]}" = "=" ] && (( counter++ ))
295
-		else
296
-			case "${words[$counter]}" in
297
-				-*)
298
-					;;
299
-				*)
300
-					break
301
-					;;
302
-			esac
303
-		fi
304
-
305
-		# Bash splits words at "=", retaining "=" as a word, examples:
306
-		# "--debug=false" => 3 words, "--log-opt syslog-facility=daemon" => 4 words
307
-		while [ "${words[$counter + 1]}" = "=" ] ; do
308
-			counter=$(( counter + 2))
309
-		done
310
-
311
-		(( counter++ ))
312
-	done
313
-
314
-	echo $counter
315
-}
316
-
317
-# If we are currently completing the value of a map option (key=value)
318
-# which matches the extglob given as an argument, returns key.
319
-# This function is needed for key-specific completions.
320
-__docker_map_key_of_current_option() {
321
-	local glob="$1"
322
-
323
-	local key glob_pos
324
-	if [ "$cur" = "=" ] ; then        # key= case
325
-		key="$prev"
326
-		glob_pos=$((cword - 2))
327
-	elif [[ $cur == *=* ]] ; then     # key=value case (OSX)
328
-		key=${cur%=*}
329
-		glob_pos=$((cword - 1))
330
-	elif [ "$prev" = "=" ] ; then
331
-		key=${words[$cword - 2]}  # key=value case
332
-		glob_pos=$((cword - 3))
333
-	else
334
-		return
335
-	fi
336
-
337
-	[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--))  # --option=key=value syntax
338
-
339
-	[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
340
-}
341
-
342
-# Returns the value of the first option matching option_glob.
343
-# Valid values for option_glob are option names like '--log-level' and
344
-# globs like '--log-level|-l'
345
-# Only positions between the command and the current word are considered.
346
-__docker_value_of_option() {
347
-	local option_extglob=$(__docker_to_extglob "$1")
348
-
349
-	local counter=$((command_pos + 1))
350
-	while [ $counter -lt $cword ]; do
351
-		case ${words[$counter]} in
352
-			$option_extglob )
353
-				echo ${words[$counter + 1]}
354
-				break
355
-				;;
356
-		esac
357
-		(( counter++ ))
358
-	done
359
-}
360
-
361
-# Transforms a multiline list of strings into a single line string
362
-# with the words separated by "|".
363
-# This is used to prepare arguments to __docker_pos_first_nonflag().
364
-__docker_to_alternatives() {
365
-	local parts=( $1 )
366
-	local IFS='|'
367
-	echo "${parts[*]}"
368
-}
369
-
370
-# Transforms a multiline list of options into an extglob pattern
371
-# suitable for use in case statements.
372
-__docker_to_extglob() {
373
-	local extglob=$( __docker_to_alternatives "$1" )
374
-	echo "@($extglob)"
375
-}
376
-
377
-# Subcommand processing.
378
-# Locates the first occurrence of any of the subcommands contained in the
379
-# first argument. In case of a match, calls the corresponding completion
380
-# function and returns 0.
381
-# If no match is found, 1 is returned. The calling function can then
382
-# continue processing its completion.
383
-#
384
-# TODO if the preceding command has options that accept arguments and an
385
-# argument is equal ot one of the subcommands, this is falsely detected as
386
-# a match.
387
-__docker_subcommands() {
388
-	local subcommands="$1"
389
-
390
-	local counter=$(($command_pos + 1))
391
-	while [ $counter -lt $cword ]; do
392
-		case "${words[$counter]}" in
393
-			$(__docker_to_extglob "$subcommands") )
394
-				subcommand_pos=$counter
395
-				local subcommand=${words[$counter]}
396
-				local completions_func=_docker_${command}_${subcommand}
397
-				declare -F $completions_func >/dev/null && $completions_func
398
-				return 0
399
-				;;
400
-		esac
401
-		(( counter++ ))
402
-	done
403
-	return 1
404
-}
405
-
406
-# suppress trailing whitespace
407
-__docker_nospace() {
408
-	# compopt is not available in ancient bash versions
409
-	type compopt &>/dev/null && compopt -o nospace
410
-}
411
-
412
-__docker_complete_resolved_hostname() {
413
-	command -v host >/dev/null 2>&1 || return
414
-	COMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') )
415
-}
416
-
417
-__docker_complete_capabilities() {
418
-	# The list of capabilities is defined in types.go, ALL was added manually.
419
-	COMPREPLY=( $( compgen -W "
420
-		ALL
421
-		AUDIT_CONTROL
422
-		AUDIT_WRITE
423
-		AUDIT_READ
424
-		BLOCK_SUSPEND
425
-		CHOWN
426
-		DAC_OVERRIDE
427
-		DAC_READ_SEARCH
428
-		FOWNER
429
-		FSETID
430
-		IPC_LOCK
431
-		IPC_OWNER
432
-		KILL
433
-		LEASE
434
-		LINUX_IMMUTABLE
435
-		MAC_ADMIN
436
-		MAC_OVERRIDE
437
-		MKNOD
438
-		NET_ADMIN
439
-		NET_BIND_SERVICE
440
-		NET_BROADCAST
441
-		NET_RAW
442
-		SETFCAP
443
-		SETGID
444
-		SETPCAP
445
-		SETUID
446
-		SYS_ADMIN
447
-		SYS_BOOT
448
-		SYS_CHROOT
449
-		SYSLOG
450
-		SYS_MODULE
451
-		SYS_NICE
452
-		SYS_PACCT
453
-		SYS_PTRACE
454
-		SYS_RAWIO
455
-		SYS_RESOURCE
456
-		SYS_TIME
457
-		SYS_TTY_CONFIG
458
-		WAKE_ALARM
459
-	" -- "$cur" ) )
460
-}
461
-
462
-__docker_complete_detach-keys() {
463
-	case "$prev" in
464
-		--detach-keys)
465
-			case "$cur" in
466
-				*,)
467
-					COMPREPLY=( $( compgen -W "${cur}ctrl-" -- "$cur" ) )
468
-					;;
469
-				*)
470
-					COMPREPLY=( $( compgen -W "ctrl-" -- "$cur" ) )
471
-					;;
472
-			esac
473
-
474
-			__docker_nospace
475
-			return
476
-			;;
477
-	esac
478
-	return 1
479
-}
480
-
481
-__docker_complete_isolation() {
482
-	COMPREPLY=( $( compgen -W "default hyperv process" -- "$cur" ) )
483
-}
484
-
485
-__docker_complete_log_drivers() {
486
-	COMPREPLY=( $( compgen -W "
487
-		awslogs
488
-		etwlogs
489
-		fluentd
490
-		gcplogs
491
-		gelf
492
-		journald
493
-		json-file
494
-		none
495
-		splunk
496
-		syslog
497
-	" -- "$cur" ) )
498
-}
499
-
500
-__docker_complete_log_options() {
501
-	# see docs/reference/logging/index.md
502
-	local awslogs_options="awslogs-region awslogs-group awslogs-stream"
503
-	local fluentd_options="env fluentd-address fluentd-async-connect fluentd-buffer-limit fluentd-retry-wait fluentd-max-retries labels tag"
504
-	local gcplogs_options="env gcp-log-cmd gcp-project labels"
505
-	local gelf_options="env gelf-address gelf-compression-level gelf-compression-type labels tag"
506
-	local journald_options="env labels tag"
507
-	local json_file_options="env labels max-file max-size"
508
-	local syslog_options="env labels syslog-address syslog-facility syslog-format syslog-tls-ca-cert syslog-tls-cert syslog-tls-key syslog-tls-skip-verify tag"
509
-	local splunk_options="env labels splunk-caname splunk-capath splunk-index splunk-insecureskipverify splunk-source splunk-sourcetype splunk-token splunk-url tag"
510
-
511
-	local all_options="$fluentd_options $gcplogs_options $gelf_options $journald_options $json_file_options $syslog_options $splunk_options"
512
-
513
-	case $(__docker_value_of_option --log-driver) in
514
-		'')
515
-			COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) )
516
-			;;
517
-		awslogs)
518
-			COMPREPLY=( $( compgen -W "$awslogs_options" -S = -- "$cur" ) )
519
-			;;
520
-		fluentd)
521
-			COMPREPLY=( $( compgen -W "$fluentd_options" -S = -- "$cur" ) )
522
-			;;
523
-		gcplogs)
524
-			COMPREPLY=( $( compgen -W "$gcplogs_options" -S = -- "$cur" ) )
525
-			;;
526
-		gelf)
527
-			COMPREPLY=( $( compgen -W "$gelf_options" -S = -- "$cur" ) )
528
-			;;
529
-		journald)
530
-			COMPREPLY=( $( compgen -W "$journald_options" -S = -- "$cur" ) )
531
-			;;
532
-		json-file)
533
-			COMPREPLY=( $( compgen -W "$json_file_options" -S = -- "$cur" ) )
534
-			;;
535
-		syslog)
536
-			COMPREPLY=( $( compgen -W "$syslog_options" -S = -- "$cur" ) )
537
-			;;
538
-		splunk)
539
-			COMPREPLY=( $( compgen -W "$splunk_options" -S = -- "$cur" ) )
540
-			;;
541
-		*)
542
-			return
543
-			;;
544
-	esac
545
-
546
-	__docker_nospace
547
-}
548
-
549
-__docker_complete_log_driver_options() {
550
-	local key=$(__docker_map_key_of_current_option '--log-opt')
551
-	case "$key" in
552
-		fluentd-async-connect)
553
-			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
554
-			return
555
-			;;
556
-		gelf-address)
557
-			COMPREPLY=( $( compgen -W "udp" -S "://" -- "${cur##*=}" ) )
558
-			__docker_nospace
559
-			return
560
-			;;
561
-		gelf-compression-level)
562
-			COMPREPLY=( $( compgen -W "1 2 3 4 5 6 7 8 9" -- "${cur##*=}" ) )
563
-			return
564
-			;;
565
-		gelf-compression-type)
566
-			COMPREPLY=( $( compgen -W "gzip none zlib" -- "${cur##*=}" ) )
567
-			return
568
-			;;
569
-		syslog-address)
570
-			COMPREPLY=( $( compgen -W "tcp:// tcp+tls:// udp:// unix://" -- "${cur##*=}" ) )
571
-			__docker_nospace
572
-			__ltrim_colon_completions "${cur}"
573
-			return
574
-			;;
575
-		syslog-facility)
576
-			COMPREPLY=( $( compgen -W "
577
-				auth
578
-				authpriv
579
-				cron
580
-				daemon
581
-				ftp
582
-				kern
583
-				local0
584
-				local1
585
-				local2
586
-				local3
587
-				local4
588
-				local5
589
-				local6
590
-				local7
591
-				lpr
592
-				mail
593
-				news
594
-				syslog
595
-				user
596
-				uucp
597
-			" -- "${cur##*=}" ) )
598
-			return
599
-			;;
600
-		syslog-format)
601
-			COMPREPLY=( $( compgen -W "rfc3164 rfc5424 rfc5424micro" -- "${cur##*=}" ) )
602
-			return
603
-			;;
604
-		syslog-tls-ca-cert|syslog-tls-cert|syslog-tls-key)
605
-			_filedir
606
-			return
607
-			;;
608
-		syslog-tls-skip-verify)
609
-			COMPREPLY=( $( compgen -W "true" -- "${cur##*=}" ) )
610
-			return
611
-			;;
612
-		splunk-url)
613
-			COMPREPLY=( $( compgen -W "http:// https://" -- "${cur##*=}" ) )
614
-			__docker_nospace
615
-			__ltrim_colon_completions "${cur}"
616
-			return
617
-			;;
618
-		splunk-insecureskipverify)
619
-			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
620
-			return
621
-			;;
622
-	esac
623
-	return 1
624
-}
625
-
626
-__docker_complete_log_levels() {
627
-	COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) )
628
-}
629
-
630
-__docker_complete_restart() {
631
-	case "$prev" in
632
-		--restart)
633
-			case "$cur" in
634
-				on-failure:*)
635
-					;;
636
-				*)
637
-					COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") )
638
-					;;
639
-			esac
640
-			return
641
-			;;
642
-	esac
643
-	return 1
644
-}
645
-
646
-# a selection of the available signals that is most likely of interest in the
647
-# context of docker containers.
648
-__docker_complete_signals() {
649
-	local signals=(
650
-		SIGCONT
651
-		SIGHUP
652
-		SIGINT
653
-		SIGKILL
654
-		SIGQUIT
655
-		SIGSTOP
656
-		SIGTERM
657
-		SIGUSR1
658
-		SIGUSR2
659
-	)
660
-	COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) )
661
-}
662
-
663
-__docker_complete_user_group() {
664
-	if [[ $cur == *:* ]] ; then
665
-		COMPREPLY=( $(compgen -g -- "${cur#*:}") )
666
-	else
667
-		COMPREPLY=( $(compgen -u -S : -- "$cur") )
668
-		__docker_nospace
669
-	fi
670
-}
671
-
672
-# global options that may appear after the docker command
673
-_docker_docker() {
674
-	local boolean_options="
675
-		$global_boolean_options
676
-		--help
677
-		--version -v
678
-	"
679
-
680
-	case "$prev" in
681
-		--config)
682
-			_filedir -d
683
-			return
684
-			;;
685
-		--log-level|-l)
686
-			__docker_complete_log_levels
687
-			return
688
-			;;
689
-		$(__docker_to_extglob "$global_options_with_args") )
690
-			return
691
-			;;
692
-	esac
693
-
694
-	case "$cur" in
695
-		-*)
696
-			COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) )
697
-			;;
698
-		*)
699
-			local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
700
-			if [ $cword -eq $counter ]; then
701
-				COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
702
-			fi
703
-			;;
704
-	esac
705
-}
706
-
707
-_docker_attach() {
708
-	__docker_complete_detach-keys && return
709
-
710
- 	case "$cur" in
711
-		-*)
712
-			COMPREPLY=( $( compgen -W "--detach-keys --help --no-stdin --sig-proxy=false" -- "$cur" ) )
713
-			;;
714
-		*)
715
-			local counter=$(__docker_pos_first_nonflag '--detach-keys')
716
-			if [ $cword -eq $counter ]; then
717
-				__docker_complete_containers_running
718
-			fi
719
-			;;
720
-	esac
721
-}
722
-
723
-_docker_build() {
724
-	local options_with_args="
725
-		--build-arg
726
-		--cgroup-parent
727
-		--cpuset-cpus
728
-		--cpuset-mems
729
-		--cpu-shares -c
730
-		--cpu-period
731
-		--cpu-quota
732
-		--file -f
733
-		--isolation
734
-		--label
735
-		--memory -m
736
-		--memory-swap
737
-		--shm-size
738
-		--tag -t
739
-		--ulimit
740
-	"
741
-
742
-	local boolean_options="
743
-		--disable-content-trust=false
744
-		--force-rm
745
-		--help
746
-		--no-cache
747
-		--pull
748
-		--quiet -q
749
-		--rm
750
-	"
751
-
752
-	local all_options="$options_with_args $boolean_options"
753
-
754
-	case "$prev" in
755
-		--build-arg)
756
-			COMPREPLY=( $( compgen -e -- "$cur" ) )
757
-			__docker_nospace
758
-			return
759
-			;;
760
-		--file|-f)
761
-			_filedir
762
-			return
763
-			;;
764
-		--isolation)
765
-			__docker_complete_isolation
766
-			return
767
-			;;
768
-		--tag|-t)
769
-			__docker_complete_image_repos_and_tags
770
-			return
771
-			;;
772
-		$(__docker_to_extglob "$options_with_args") )
773
-			return
774
-			;;
775
-	esac
776
-
777
-	case "$cur" in
778
-		-*)
779
-			COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
780
-			;;
781
-		*)
782
-			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
783
-			if [ $cword -eq $counter ]; then
784
-				_filedir -d
785
-			fi
786
-			;;
787
-	esac
788
-}
789
-
790
-_docker_commit() {
791
-	case "$prev" in
792
-		--author|-a|--change|-c|--message|-m)
793
-			return
794
-			;;
795
-	esac
796
-
797
-	case "$cur" in
798
-		-*)
799
-			COMPREPLY=( $( compgen -W "--author -a --change -c --help --message -m --pause=false -p=false" -- "$cur" ) )
800
-			;;
801
-		*)
802
-			local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m')
803
-
804
-			if [ $cword -eq $counter ]; then
805
-				__docker_complete_containers_all
806
-				return
807
-			fi
808
-			(( counter++ ))
809
-
810
-			if [ $cword -eq $counter ]; then
811
-				__docker_complete_image_repos_and_tags
812
-				return
813
-			fi
814
-			;;
815
-	esac
816
-}
817
-
818
-_docker_cp() {
819
-	case "$cur" in
820
-		-*)
821
-			COMPREPLY=( $( compgen -W "--follow-link -L --help" -- "$cur" ) )
822
-			;;
823
-		*)
824
-			local counter=$(__docker_pos_first_nonflag)
825
-			if [ $cword -eq $counter ]; then
826
-				case "$cur" in
827
-					*:)
828
-						return
829
-						;;
830
-					*)
831
-						# combined container and filename completion
832
-						_filedir
833
-						local files=( ${COMPREPLY[@]} )
834
-
835
-						__docker_complete_containers_all
836
-						COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
837
-						local containers=( ${COMPREPLY[@]} )
838
-
839
-						COMPREPLY=( $( compgen -W "${files[*]} ${containers[*]}" -- "$cur" ) )
840
-						if [[ "$COMPREPLY" == *: ]]; then
841
-							__docker_nospace
842
-						fi
843
-						return
844
-						;;
845
-				esac
846
-			fi
847
-			(( counter++ ))
848
-
849
-			if [ $cword -eq $counter ]; then
850
-				if [ -e "$prev" ]; then
851
-					__docker_complete_containers_all
852
-					COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
853
-					__docker_nospace
854
-				else
855
-					_filedir
856
-				fi
857
-				return
858
-			fi
859
-			;;
860
-	esac
861
-}
862
-
863
-_docker_create() {
864
-	_docker_run
865
-}
866
-
867
-_docker_daemon() {
868
-	local boolean_options="
869
-		$global_boolean_options
870
-		--disable-legacy-registry
871
-		--help
872
-		--icc=false
873
-		--ip-forward=false
874
-		--ip-masq=false
875
-		--iptables=false
876
-		--ipv6
877
-		--live-restore
878
-		--raw-logs
879
-		--selinux-enabled
880
-		--userland-proxy=false
881
-	"
882
-	local options_with_args="
883
-		$global_options_with_args
884
-		--add-runtime
885
-		--api-cors-header
886
-		--authorization-plugin
887
-		--bip
888
-		--bridge -b
889
-		--cgroup-parent
890
-		--cluster-advertise
891
-		--cluster-store
892
-		--cluster-store-opt
893
-		--config-file
894
-		--containerd
895
-		--default-gateway
896
-		--default-gateway-v6
897
-		--default-ulimit
898
-		--dns
899
-		--dns-search
900
-		--dns-opt
901
-		--exec-opt
902
-		--exec-root
903
-		--fixed-cidr
904
-		--fixed-cidr-v6
905
-		--graph -g
906
-		--group -G
907
-		--insecure-registry
908
-		--ip
909
-		--label
910
-		--log-driver
911
-		--log-opt
912
-		--max-concurrent-downloads
913
-		--max-concurrent-uploads
914
-		--mtu
915
-		--oom-score-adjust
916
-		--pidfile -p
917
-		--registry-mirror
918
-		--storage-driver -s
919
-		--storage-opt
920
-		--userns-remap
921
-	"
922
-
923
-	__docker_complete_log_driver_options && return
924
-
925
- 	key=$(__docker_map_key_of_current_option '--cluster-store-opt')
926
- 	case "$key" in
927
- 		kv.*file)
928
-			cur=${cur##*=}
929
- 			_filedir
930
- 			return
931
- 			;;
932
- 	esac
933
-
934
- 	local key=$(__docker_map_key_of_current_option '--storage-opt')
935
- 	case "$key" in
936
- 		dm.blkdiscard|dm.override_udev_sync_check|dm.use_deferred_removal|dm.use_deferred_deletion)
937
- 			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
938
- 			return
939
- 			;;
940
- 		dm.fs)
941
- 			COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur##*=}" ) )
942
- 			return
943
- 			;;
944
- 		dm.thinpooldev)
945
-			cur=${cur##*=}
946
- 			_filedir
947
- 			return
948
- 			;;
949
- 	esac
950
-
951
-	case "$prev" in
952
-		--authorization-plugin)
953
-			__docker_complete_plugins Authorization
954
-			return
955
-			;;
956
-		--cluster-store)
957
-			COMPREPLY=( $( compgen -W "consul etcd zk" -S "://" -- "$cur" ) )
958
-			__docker_nospace
959
-			return
960
-			;;
961
-		--cluster-store-opt)
962
-			COMPREPLY=( $( compgen -W "discovery.heartbeat discovery.ttl kv.cacertfile kv.certfile kv.keyfile kv.path" -S = -- "$cur" ) )
963
-			__docker_nospace
964
-			return
965
-			;;
966
-		--exec-root|--graph|-g)
967
-			_filedir -d
968
-			return
969
-			;;
970
-		--log-driver)
971
-			__docker_complete_log_drivers
972
-			return
973
-			;;
974
-		--config-file|--containerd|--pidfile|-p|--tlscacert|--tlscert|--tlskey)
975
-			_filedir
976
-			return
977
-			;;
978
-		--storage-driver|-s)
979
-			COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay  overlay2 vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) )
980
-			return
981
-			;;
982
-		--storage-opt)
983
-			local btrfs_options="btrfs.min_space"
984
-			local devicemapper_options="
985
-				dm.basesize
986
-				dm.blkdiscard
987
-				dm.blocksize
988
-				dm.fs
989
-				dm.loopdatasize
990
-				dm.loopmetadatasize
991
-				dm.min_free_space
992
-				dm.mkfsarg
993
-				dm.mountopt
994
-				dm.override_udev_sync_check
995
-				dm.thinpooldev
996
-				dm.use_deferred_deletion
997
-				dm.use_deferred_removal
998
-			"
999
-			local zfs_options="zfs.fsname"
1000
-
1001
-			case $(__docker_value_of_option '--storage-driver|-s') in
1002
-				'')
1003
-					COMPREPLY=( $( compgen -W "$btrfs_options $devicemapper_options $zfs_options" -S = -- "$cur" ) )
1004
-					;;
1005
-				btrfs)
1006
-					COMPREPLY=( $( compgen -W "$btrfs_options" -S = -- "$cur" ) )
1007
-					;;
1008
-				devicemapper)
1009
-					COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) )
1010
-					;;
1011
-				zfs)
1012
-					COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) )
1013
-					;;
1014
-				*)
1015
-					return
1016
-					;;
1017
-			esac
1018
-			__docker_nospace
1019
-			return
1020
-			;;
1021
-		--log-level|-l)
1022
-			__docker_complete_log_levels
1023
-			return
1024
-			;;
1025
-		--log-opt)
1026
-			__docker_complete_log_options
1027
-			return
1028
-			;;
1029
-		--userns-remap)
1030
-			__docker_complete_user_group
1031
-			return
1032
-			;;
1033
-		$(__docker_to_extglob "$options_with_args") )
1034
-			return
1035
-			;;
1036
-	esac
1037
-
1038
-	case "$cur" in
1039
-		-*)
1040
-			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
1041
-			;;
1042
-	esac
1043
-}
1044
-
1045
-_docker_diff() {
1046
-	case "$cur" in
1047
-		-*)
1048
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1049
-			;;
1050
-		*)
1051
-			local counter=$(__docker_pos_first_nonflag)
1052
-			if [ $cword -eq $counter ]; then
1053
-				__docker_complete_containers_all
1054
-			fi
1055
-			;;
1056
-	esac
1057
-}
1058
-
1059
-_docker_events() {
1060
-	local key=$(__docker_map_key_of_current_option '-f|--filter')
1061
-	case "$key" in
1062
-		container)
1063
-			cur="${cur##*=}"
1064
-			__docker_complete_containers_all
1065
-			return
1066
-			;;
1067
-		daemon)
1068
-			local name=$(__docker_q info | sed -n 's/^\(ID\|Name\): //p')
1069
-			COMPREPLY=( $( compgen -W "$name" -- "${cur##*=}" ) )
1070
-			return
1071
-			;;
1072
-		event)
1073
-			COMPREPLY=( $( compgen -W "
1074
-				attach
1075
-				commit
1076
-				connect
1077
-				copy
1078
-				create
1079
-				delete
1080
-				destroy
1081
-				detach
1082
-				die
1083
-				disconnect
1084
-				exec_create
1085
-				exec_detach
1086
-				exec_start
1087
-				export
1088
-				import
1089
-				kill
1090
-				load
1091
-				mount
1092
-				oom
1093
-				pause
1094
-				pull
1095
-				push
1096
-				reload
1097
-				rename
1098
-				resize
1099
-				restart
1100
-				save
1101
-				start
1102
-				stop
1103
-				tag
1104
-				top
1105
-				unmount
1106
-				unpause
1107
-				untag
1108
-				update
1109
-			" -- "${cur##*=}" ) )
1110
-			return
1111
-			;;
1112
-		image)
1113
-			cur="${cur##*=}"
1114
-			__docker_complete_images
1115
-			return
1116
-			;;
1117
-		network)
1118
-			cur="${cur##*=}"
1119
-			__docker_complete_networks
1120
-			return
1121
-			;;
1122
-		type)
1123
-			COMPREPLY=( $( compgen -W "container daemon image network volume" -- "${cur##*=}" ) )
1124
-			return
1125
-			;;
1126
-		volume)
1127
-			cur="${cur##*=}"
1128
-			__docker_complete_volumes
1129
-			return
1130
-			;;
1131
-	esac
1132
-
1133
-	case "$prev" in
1134
-		--filter|-f)
1135
-			COMPREPLY=( $( compgen -S = -W "container daemon event image label network type volume" -- "$cur" ) )
1136
-			__docker_nospace
1137
-			return
1138
-			;;
1139
-		--since|--until)
1140
-			return
1141
-			;;
1142
-	esac
1143
-
1144
-	case "$cur" in
1145
-		-*)
1146
-			COMPREPLY=( $( compgen -W "--filter -f --help --since --until" -- "$cur" ) )
1147
-			;;
1148
-	esac
1149
-}
1150
-
1151
-_docker_exec() {
1152
-	__docker_complete_detach-keys && return
1153
-
1154
-	case "$prev" in
1155
-		--user|-u)
1156
-			__docker_complete_user_group
1157
-			return
1158
-			;;
1159
-	esac
1160
-
1161
-	case "$cur" in
1162
-		-*)
1163
-			COMPREPLY=( $( compgen -W "--detach -d --detach-keys --help --interactive -i --privileged -t --tty -u --user" -- "$cur" ) )
1164
-			;;
1165
-		*)
1166
-			__docker_complete_containers_running
1167
-			;;
1168
-	esac
1169
-}
1170
-
1171
-_docker_export() {
1172
-	case "$cur" in
1173
-		-*)
1174
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1175
-			;;
1176
-		*)
1177
-			local counter=$(__docker_pos_first_nonflag)
1178
-			if [ $cword -eq $counter ]; then
1179
-				__docker_complete_containers_all
1180
-			fi
1181
-			;;
1182
-	esac
1183
-}
1184
-
1185
-_docker_help() {
1186
-	local counter=$(__docker_pos_first_nonflag)
1187
-	if [ $cword -eq $counter ]; then
1188
-		COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
1189
-	fi
1190
-}
1191
-
1192
-_docker_history() {
1193
-	case "$cur" in
1194
-		-*)
1195
-			COMPREPLY=( $( compgen -W "--help --human=false -H=false --no-trunc --quiet -q" -- "$cur" ) )
1196
-			;;
1197
-		*)
1198
-			local counter=$(__docker_pos_first_nonflag)
1199
-			if [ $cword -eq $counter ]; then
1200
-				__docker_complete_images
1201
-			fi
1202
-			;;
1203
-	esac
1204
-}
1205
-
1206
-_docker_images() {
1207
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
1208
-	case "$key" in
1209
-		before)
1210
-			cur="${cur##*=}"
1211
-			__docker_complete_images
1212
-			return
1213
-			;;
1214
-		dangling)
1215
-			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
1216
-			return
1217
-			;;
1218
-		label)
1219
-			return
1220
-			;;
1221
-		since)
1222
-			cur="${cur##*=}"
1223
-			__docker_complete_images
1224
-			return
1225
-			;;
1226
-	esac
1227
-
1228
-	case "$prev" in
1229
-		--filter|-f)
1230
-			COMPREPLY=( $( compgen -S = -W "before dangling label since" -- "$cur" ) )
1231
-			__docker_nospace
1232
-			return
1233
-			;;
1234
-                --format)
1235
-			return
1236
-			;;
1237
-	esac
1238
-
1239
-	case "$cur" in
1240
-		-*)
1241
-			COMPREPLY=( $( compgen -W "--all -a --digests --filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) )
1242
-			;;
1243
-		=)
1244
-			return
1245
-			;;
1246
-		*)
1247
-			__docker_complete_image_repos
1248
-			;;
1249
-	esac
1250
-}
1251
-
1252
-_docker_import() {
1253
-	case "$prev" in
1254
-		--change|-c|--message|-m)
1255
-			return
1256
-			;;
1257
-	esac
1258
-
1259
-	case "$cur" in
1260
-		-*)
1261
-			COMPREPLY=( $( compgen -W "--change -c --help --message -m" -- "$cur" ) )
1262
-			;;
1263
-		*)
1264
-			local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m')
1265
-			if [ $cword -eq $counter ]; then
1266
-				return
1267
-			fi
1268
-			(( counter++ ))
1269
-
1270
-			if [ $cword -eq $counter ]; then
1271
-				__docker_complete_image_repos_and_tags
1272
-				return
1273
-			fi
1274
-			;;
1275
-	esac
1276
-}
1277
-
1278
-_docker_info() {
1279
-	case "$cur" in
1280
-		-*)
1281
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1282
-			;;
1283
-	esac
1284
-}
1285
-
1286
-_docker_inspect() {
1287
-	case "$prev" in
1288
-		--format|-f)
1289
-			return
1290
-			;;
1291
-		--type)
1292
-                     COMPREPLY=( $( compgen -W "image container" -- "$cur" ) )
1293
-                     return
1294
-                        ;;
1295
-
1296
-	esac
1297
-
1298
-	case "$cur" in
1299
-		-*)
1300
-			COMPREPLY=( $( compgen -W "--format -f --help --size -s --type" -- "$cur" ) )
1301
-			;;
1302
-		*)
1303
-			case $(__docker_value_of_option --type) in
1304
-				'')
1305
-					__docker_complete_containers_and_images
1306
-					;;
1307
-				container)
1308
-					__docker_complete_containers_all
1309
-					;;
1310
-				image)
1311
-					__docker_complete_images
1312
-					;;
1313
-			esac
1314
-	esac
1315
-}
1316
-
1317
-_docker_kill() {
1318
-	case "$prev" in
1319
-		--signal|-s)
1320
-			__docker_complete_signals
1321
-			return
1322
-			;;
1323
-	esac
1324
-
1325
-	case "$cur" in
1326
-		-*)
1327
-			COMPREPLY=( $( compgen -W "--help --signal -s" -- "$cur" ) )
1328
-			;;
1329
-		*)
1330
-			__docker_complete_containers_running
1331
-			;;
1332
-	esac
1333
-}
1334
-
1335
-_docker_load() {
1336
-	case "$prev" in
1337
-		--input|-i)
1338
-			_filedir
1339
-			return
1340
-			;;
1341
-	esac
1342
-
1343
-	case "$cur" in
1344
-		-*)
1345
-			COMPREPLY=( $( compgen -W "--help --input -i --quiet -q" -- "$cur" ) )
1346
-			;;
1347
-	esac
1348
-}
1349
-
1350
-_docker_login() {
1351
-	case "$prev" in
1352
-		--password|-p|--username|-u)
1353
-			return
1354
-			;;
1355
-	esac
1356
-
1357
-	case "$cur" in
1358
-		-*)
1359
-			COMPREPLY=( $( compgen -W "--help --password -p --username -u" -- "$cur" ) )
1360
-			;;
1361
-	esac
1362
-}
1363
-
1364
-_docker_logout() {
1365
-	case "$cur" in
1366
-		-*)
1367
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1368
-			;;
1369
-	esac
1370
-}
1371
-
1372
-_docker_logs() {
1373
-	case "$prev" in
1374
-		--since|--tail)
1375
-			return
1376
-			;;
1377
-	esac
1378
-
1379
-	case "$cur" in
1380
-		-*)
1381
-			COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail --timestamps -t" -- "$cur" ) )
1382
-			;;
1383
-		*)
1384
-			local counter=$(__docker_pos_first_nonflag '--tail')
1385
-			if [ $cword -eq $counter ]; then
1386
-				__docker_complete_containers_all
1387
-			fi
1388
-			;;
1389
-	esac
1390
-}
1391
-
1392
-_docker_network_connect() {
1393
-	local options_with_args="
1394
-		--alias
1395
-		--ip
1396
-		--ip6
1397
-		--link
1398
-		--link-local-ip
1399
-	"
1400
-
1401
-	local boolean_options="
1402
-		--help
1403
-	"
1404
-
1405
-	case "$prev" in
1406
-		--link)
1407
-			case "$cur" in
1408
-				*:*)
1409
-					;;
1410
-				*)
1411
-					__docker_complete_containers_running
1412
-					COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
1413
-					__docker_nospace
1414
-					;;
1415
-			esac
1416
-			return
1417
-			;;
1418
-		$(__docker_to_extglob "$options_with_args") )
1419
-			return
1420
-			;;
1421
-	esac
1422
-
1423
-	case "$cur" in
1424
-		-*)
1425
-			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
1426
-			;;
1427
-		*)
1428
-			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
1429
-			if [ $cword -eq $counter ]; then
1430
-				__docker_complete_networks
1431
-			elif [ $cword -eq $(($counter + 1)) ]; then
1432
-				__docker_complete_containers_all
1433
-			fi
1434
-			;;
1435
-	esac
1436
-}
1437
-
1438
-_docker_network_create() {
1439
-	case "$prev" in
1440
-		--aux-address|--gateway|--internal|--ip-range|--ipam-opt|--ipv6|--opt|-o|--subnet)
1441
-			return
1442
-			;;
1443
-		--ipam-driver)
1444
-			COMPREPLY=( $( compgen -W "default" -- "$cur" ) )
1445
-			return
1446
-			;;
1447
-		--driver|-d)
1448
-			local plugins="$(__docker_plugins Network) macvlan"
1449
-			# remove drivers that allow one instance only
1450
-			plugins=${plugins/ host / }
1451
-			plugins=${plugins/ null / }
1452
-			COMPREPLY=( $(compgen -W "$plugins" -- "$cur") )
1453
-			return
1454
-			;;
1455
-		--label)
1456
-			return
1457
-			;;
1458
-	esac
1459
-
1460
-	case "$cur" in
1461
-		-*)
1462
-			COMPREPLY=( $( compgen -W "--aux-address --driver -d --gateway --help --internal --ip-range --ipam-driver --ipam-opt --ipv6 --label --opt -o --subnet" -- "$cur" ) )
1463
-			;;
1464
-	esac
1465
-}
1466
-
1467
-_docker_network_disconnect() {
1468
-	case "$cur" in
1469
-		-*)
1470
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1471
-			;;
1472
-		*)
1473
-			local counter=$(__docker_pos_first_nonflag)
1474
-			if [ $cword -eq $counter ]; then
1475
-				__docker_complete_networks
1476
-			elif [ $cword -eq $(($counter + 1)) ]; then
1477
-				__docker_complete_containers_in_network "$prev"
1478
-			fi
1479
-			;;
1480
-	esac
1481
-}
1482
-
1483
-_docker_network_inspect() {
1484
-	case "$prev" in
1485
-		--format|-f)
1486
-			return
1487
-			;;
1488
-	esac
1489
-
1490
-	case "$cur" in
1491
-		-*)
1492
-			COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) )
1493
-			;;
1494
-		*)
1495
-			__docker_complete_networks
1496
-	esac
1497
-}
1498
-
1499
-_docker_network_ls() {
1500
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
1501
-	case "$key" in
1502
-		driver)
1503
-			local plugins=" $(__docker_plugins Network) "
1504
-			COMPREPLY=( $(compgen -W "$plugins" -- "${cur##*=}") )
1505
-			return
1506
-			;;
1507
-		id)
1508
-			cur="${cur##*=}"
1509
-			__docker_complete_network_ids
1510
-			return
1511
-			;;
1512
-		name)
1513
-			cur="${cur##*=}"
1514
-			__docker_complete_network_names
1515
-			return
1516
-			;;
1517
-		type)
1518
-			COMPREPLY=( $( compgen -W "builtin custom" -- "${cur##*=}" ) )
1519
-			return
1520
-			;;
1521
-	esac
1522
-
1523
-	case "$prev" in
1524
-		--filter|-f)
1525
-			COMPREPLY=( $( compgen -S = -W "driver id label name type" -- "$cur" ) )
1526
-			__docker_nospace
1527
-			return
1528
-			;;
1529
-	esac
1530
-
1531
-	case "$cur" in
1532
-		-*)
1533
-			COMPREPLY=( $( compgen -W "--filter -f --help --no-trunc --quiet -q" -- "$cur" ) )
1534
-			;;
1535
-	esac
1536
-}
1537
-
1538
-_docker_network_rm() {
1539
-	case "$cur" in
1540
-		-*)
1541
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1542
-			;;
1543
-		*)
1544
-			__docker_complete_networks type=custom
1545
-	esac
1546
-}
1547
-
1548
-_docker_network() {
1549
-	local subcommands="
1550
-		connect
1551
-		create
1552
-		disconnect
1553
-		inspect
1554
-		ls
1555
-		rm
1556
-	"
1557
-	__docker_subcommands "$subcommands" && return
1558
-
1559
-	case "$cur" in
1560
-		-*)
1561
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1562
-			;;
1563
-		*)
1564
-			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
1565
-			;;
1566
-	esac
1567
-}
1568
-
1569
-_docker_service() {
1570
-	local subcommands="
1571
-		create
1572
-		inspect
1573
-		ls list
1574
-		rm remove
1575
-		scale
1576
-		ps
1577
-		update
1578
-	"
1579
-	__docker_subcommands "$subcommands" && return
1580
-
1581
-	case "$cur" in
1582
-		-*)
1583
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1584
-			;;
1585
-		*)
1586
-			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
1587
-			;;
1588
-	esac
1589
-}
1590
-
1591
-_docker_service_create() {
1592
-	_docker_service_update
1593
-}
1594
-
1595
-_docker_service_inspect() {
1596
-	case "$prev" in
1597
-		--format|-f)
1598
-			return
1599
-			;;
1600
-	esac
1601
-
1602
-	case "$cur" in
1603
-		-*)
1604
-			COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) )
1605
-			;;
1606
-		*)
1607
-			__docker_complete_services
1608
-	esac
1609
-}
1610
-
1611
-_docker_service_list() {
1612
-	_docker_service_ls
1613
-}
1614
-
1615
-_docker_service_ls() {
1616
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
1617
-	case "$key" in
1618
-		id)
1619
-			__docker_complete_services --cur "${cur##*=}" --id
1620
-			return
1621
-			;;
1622
-		name)
1623
-			__docker_complete_services --cur "${cur##*=}" --name
1624
-			return
1625
-			;;
1626
-	esac
1627
-
1628
-	case "$prev" in
1629
-		--filter|-f)
1630
-			COMPREPLY=( $( compgen -W "id label name" -S = -- "$cur" ) )
1631
-			__docker_nospace
1632
-			return
1633
-			;;
1634
-	esac
1635
-
1636
-	case "$cur" in
1637
-		-*)
1638
-			COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) )
1639
-			;;
1640
-	esac
1641
-}
1642
-
1643
-_docker_service_remove() {
1644
-	_docker_service_rm
1645
-}
1646
-
1647
-_docker_service_rm() {
1648
-	case "$cur" in
1649
-		-*)
1650
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1651
-			;;
1652
-		*)
1653
-			__docker_complete_services
1654
-	esac
1655
-}
1656
-
1657
-_docker_service_scale() {
1658
-	case "$cur" in
1659
-		-*)
1660
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1661
-			;;
1662
-		*)
1663
-			__docker_complete_services
1664
-			__docker_append_to_completions "="
1665
-			__docker_nospace
1666
-			;;
1667
-	esac
1668
-}
1669
-
1670
-_docker_service_ps() {
1671
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
1672
-	case "$key" in
1673
-		desired-state)
1674
-			COMPREPLY=( $( compgen -W "accepted running" -- "${cur##*=}" ) )
1675
-			return
1676
-			;;
1677
-		name)
1678
-			__docker_complete_services --cur "${cur##*=}" --name
1679
-			return
1680
-			;;
1681
-	esac
1682
-
1683
-	case "$prev" in
1684
-		--filter|-f)
1685
-			COMPREPLY=( $( compgen -W "desired-state id name" -S = -- "$cur" ) )
1686
-			__docker_nospace
1687
-			return
1688
-			;;
1689
-	esac
1690
-
1691
-	case "$cur" in
1692
-		-*)
1693
-			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) )
1694
-			;;
1695
-		*)
1696
-			local counter=$(__docker_pos_first_nonflag '--filter|-f')
1697
-			if [ $cword -eq $counter ]; then
1698
-				__docker_complete_services
1699
-			fi
1700
-			;;
1701
-	esac
1702
-}
1703
-
1704
-_docker_service_update() {
1705
-	local $subcommand="${words[$subcommand_pos]}"
1706
-
1707
-	local options_with_args="
1708
-		--constraint
1709
-		--endpoint-mode
1710
-		--env -e
1711
-		--label -l
1712
-		--limit-cpu
1713
-		--limit-memory
1714
-		--log-driver
1715
-		--log-opt
1716
-		--mount
1717
-		--name
1718
-		--network
1719
-		--publish -p
1720
-		--replicas
1721
-		--reserve-cpu
1722
-		--reserve-memory
1723
-		--restart-condition
1724
-		--restart-delay
1725
-		--restart-max-attempts
1726
-		--restart-window
1727
-		--stop-grace-period
1728
-		--update-delay
1729
-		--update-failure-action
1730
-		--update-parallelism
1731
-		--user -u
1732
-		--workdir -w
1733
-	"
1734
-
1735
-	local boolean_options="
1736
-		--help
1737
-		--with-registry-auth
1738
-	"
1739
-
1740
-	__docker_complete_log_driver_options && return
1741
-
1742
-	if [ "$subcommand" = "create" ] ; then
1743
-		options_with_args="$options_with_args
1744
-			--container-label
1745
-			--mode
1746
-		"
1747
-
1748
-		case "$prev" in
1749
-			--mode)
1750
-				COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) )
1751
-				return
1752
-				;;
1753
-		esac
1754
-	fi
1755
-	if [ "$subcommand" = "update" ] ; then
1756
-		options_with_args="$options_with_args
1757
-			--arg
1758
-			--container-label-add
1759
-			--container-label-rm
1760
-			--image
1761
-		"
1762
-
1763
-		case "$prev" in
1764
-			--image)
1765
-				__docker_complete_image_repos_and_tags
1766
-				return
1767
-				;;
1768
-		esac
1769
-	fi
1770
-
1771
-	case "$prev" in
1772
-		--endpoint-mode)
1773
-			COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) )
1774
-			return
1775
-			;;
1776
-		--env|-e)
1777
-			COMPREPLY=( $( compgen -e -S = -- "$cur" ) )
1778
-			__docker_nospace
1779
-			return
1780
-			;;
1781
-		--log-driver)
1782
-			__docker_complete_log_drivers
1783
-			return
1784
-			;;
1785
-		--log-opt)
1786
-			__docker_complete_log_options
1787
-			return
1788
-			;;
1789
-		--network)
1790
-			__docker_complete_networks
1791
-			return
1792
-			;;
1793
-		--restart-condition)
1794
-			COMPREPLY=( $( compgen -W "any none on-failure" -- "$cur" ) )
1795
-			return
1796
-			;;
1797
-		--user|-u)
1798
-			__docker_complete_user_group
1799
-			return
1800
-			;;
1801
-		$(__docker_to_extglob "$options_with_args") )
1802
-			return
1803
-			;;
1804
-	esac
1805
-
1806
-	case "$cur" in
1807
-		-*)
1808
-			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
1809
-			;;
1810
-		*)
1811
-			if [ "$subcommand" = "update" ] ; then
1812
-				__docker_complete_services
1813
-			fi
1814
-	esac
1815
-}
1816
-
1817
-_docker_swarm() {
1818
-	local subcommands="
1819
-		init
1820
-		join
1821
-		join-token
1822
-		leave
1823
-		update
1824
-	"
1825
-	__docker_subcommands "$subcommands" && return
1826
-
1827
-	case "$cur" in
1828
-		-*)
1829
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1830
-			;;
1831
-		*)
1832
-			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
1833
-			;;
1834
-	esac
1835
-}
1836
-
1837
-_docker_swarm_init() {
1838
-	case "$prev" in
1839
-		--listen-addr)
1840
-			if [[ $cur == *: ]] ; then
1841
-				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
1842
-			fi
1843
-			return
1844
-			;;
1845
-		--advertise-addr)
1846
-			if [[ $cur == *: ]] ; then
1847
-				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
1848
-			fi
1849
-			return
1850
-			;;
1851
-	esac
1852
-
1853
-	case "$cur" in
1854
-		-*)
1855
-			COMPREPLY=( $( compgen -W "--advertise-addr --force-new-cluster --help --listen-addr" -- "$cur" ) )
1856
-			;;
1857
-	esac
1858
-}
1859
-
1860
-_docker_swarm_join() {
1861
-	case "$prev" in
1862
-		--token)
1863
-			return
1864
-			;;
1865
-		--listen-addr)
1866
-			if [[ $cur == *: ]] ; then
1867
-				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
1868
-			fi
1869
-			return
1870
-			;;
1871
-		--advertise-addr)
1872
-			if [[ $cur == *: ]] ; then
1873
-				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
1874
-			fi
1875
-			return
1876
-			;;
1877
-	esac
1878
-
1879
-	case "$cur" in
1880
-		-*)
1881
-			COMPREPLY=( $( compgen -W "--adveritse-addr --help --listen-addr --token" -- "$cur" ) )
1882
-			;;
1883
-		*:)
1884
-			COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
1885
-			;;
1886
-	esac
1887
-}
1888
-
1889
-_docker_swarm_join-token() {
1890
-	case "$cur" in
1891
-		-*)
1892
-			COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) )
1893
-			;;
1894
-		*)
1895
-			local counter=$( __docker_pos_first_nonflag )
1896
-			if [ $cword -eq $counter ]; then
1897
-				COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) )
1898
-			fi
1899
-			;;
1900
-	esac
1901
-}
1902
-
1903
-_docker_swarm_leave() {
1904
-	case "$cur" in
1905
-		-*)
1906
-			COMPREPLY=( $( compgen -W "--force --help" -- "$cur" ) )
1907
-			;;
1908
-	esac
1909
-}
1910
-
1911
-_docker_swarm_update() {
1912
-	case "$prev" in
1913
-		--cert-expiry|--dispatcher-heartbeat|--task-history-limit)
1914
-			return
1915
-			;;
1916
-	esac
1917
-
1918
-	case "$cur" in
1919
-		-*)
1920
-			COMPREPLY=( $( compgen -W "--cert-expiry --dispatcher-heartbeat --help --task-history-limit" -- "$cur" ) )
1921
-			;;
1922
-	esac
1923
-}
1924
-
1925
-_docker_node() {
1926
-	local subcommands="
1927
-		demote
1928
-		inspect
1929
-		ls list
1930
-		promote
1931
-		rm remove
1932
-		ps
1933
-		update
1934
-	"
1935
-	__docker_subcommands "$subcommands" && return
1936
-
1937
-	case "$cur" in
1938
-		-*)
1939
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1940
-			;;
1941
-		*)
1942
-			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
1943
-			;;
1944
-	esac
1945
-}
1946
-
1947
-_docker_node_demote() {
1948
-	case "$cur" in
1949
-		-*)
1950
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
1951
-			;;
1952
-		*)
1953
-			__docker_complete_nodes --filter role=manager
1954
-	esac
1955
-}
1956
-
1957
-_docker_node_inspect() {
1958
-	case "$prev" in
1959
-		--format|-f)
1960
-			return
1961
-			;;
1962
-	esac
1963
-
1964
-	case "$cur" in
1965
-		-*)
1966
-			COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) )
1967
-			;;
1968
-		*)
1969
-			__docker_complete_nodes
1970
-	esac
1971
-}
1972
-
1973
-_docker_node_list() {
1974
-	_docker_node_ls
1975
-}
1976
-
1977
-_docker_node_ls() {
1978
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
1979
-	case "$key" in
1980
-		id)
1981
-			__docker_complete_nodes --cur "${cur##*=}" --id
1982
-			return
1983
-			;;
1984
-		name)
1985
-			__docker_complete_nodes --cur "${cur##*=}" --name
1986
-			return
1987
-			;;
1988
-	esac
1989
-
1990
-	case "$prev" in
1991
-		--filter|-f)
1992
-			COMPREPLY=( $( compgen -W "id label name" -S = -- "$cur" ) )
1993
-			__docker_nospace
1994
-			return
1995
-			;;
1996
-	esac
1997
-
1998
-	case "$cur" in
1999
-		-*)
2000
-			COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) )
2001
-			;;
2002
-	esac
2003
-}
2004
-
2005
-_docker_node_promote() {
2006
-	case "$cur" in
2007
-		-*)
2008
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2009
-			;;
2010
-		*)
2011
-			__docker_complete_nodes --filter role=worker
2012
-	esac
2013
-}
2014
-
2015
-_docker_node_remove() {
2016
-	_docker_node_rm
2017
-}
2018
-
2019
-_docker_node_rm() {
2020
-	case "$cur" in
2021
-		-*)
2022
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2023
-			;;
2024
-		*)
2025
-			__docker_complete_nodes
2026
-	esac
2027
-}
2028
-
2029
-_docker_node_ps() {
2030
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
2031
-	case "$key" in
2032
-		desired-state)
2033
-			COMPREPLY=( $( compgen -W "accepted running" -- "${cur##*=}" ) )
2034
-			return
2035
-			;;
2036
-		name)
2037
-			__docker_complete_services --cur "${cur##*=}" --name
2038
-			return
2039
-			;;
2040
-	esac
2041
-
2042
-	case "$prev" in
2043
-		--filter|-f)
2044
-			COMPREPLY=( $( compgen -W "desired-state id label name" -S = -- "$cur" ) )
2045
-			__docker_nospace
2046
-			return
2047
-			;;
2048
-	esac
2049
-
2050
-	case "$cur" in
2051
-		-*)
2052
-			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) )
2053
-			;;
2054
-		*)
2055
-			local counter=$(__docker_pos_first_nonflag '--filter|-f')
2056
-			if [ $cword -eq $counter ]; then
2057
-				__docker_complete_nodes_plus_self
2058
-			fi
2059
-			;;
2060
-	esac
2061
-}
2062
-
2063
-_docker_node_update() {
2064
-	case "$prev" in
2065
-		--availability)
2066
-			COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )
2067
-			return
2068
-			;;
2069
-		--role)
2070
-			COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) )
2071
-			return
2072
-			;;
2073
-		--label-add|--label-rm)
2074
-			return
2075
-			;;
2076
-	esac
2077
-
2078
-	case "$cur" in
2079
-		-*)
2080
-			COMPREPLY=( $( compgen -W "--availability --help --label-add --label-rm --role" -- "$cur" ) )
2081
-			;;
2082
-		*)
2083
-			__docker_complete_nodes
2084
-	esac
2085
-}
2086
-
2087
-_docker_pause() {
2088
-	case "$cur" in
2089
-		-*)
2090
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2091
-			;;
2092
-		*)
2093
-			local counter=$(__docker_pos_first_nonflag)
2094
-			if [ $cword -eq $counter ]; then
2095
-				__docker_complete_containers_pauseable
2096
-			fi
2097
-			;;
2098
-	esac
2099
-}
2100
-
2101
-_docker_port() {
2102
-	case "$cur" in
2103
-		-*)
2104
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2105
-			;;
2106
-		*)
2107
-			local counter=$(__docker_pos_first_nonflag)
2108
-			if [ $cword -eq $counter ]; then
2109
-				__docker_complete_containers_all
2110
-			fi
2111
-			;;
2112
-	esac
2113
-}
2114
-
2115
-_docker_ps() {
2116
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
2117
-	case "$key" in
2118
-		ancestor)
2119
-			cur="${cur##*=}"
2120
-			__docker_complete_images
2121
-			return
2122
-			;;
2123
-		before)
2124
-			cur="${cur##*=}"
2125
-			__docker_complete_containers_all
2126
-			return
2127
-			;;
2128
-		id)
2129
-			cur="${cur##*=}"
2130
-			__docker_complete_container_ids
2131
-			return
2132
-			;;
2133
-		name)
2134
-			cur="${cur##*=}"
2135
-			__docker_complete_container_names
2136
-			return
2137
-			;;
2138
-		network)
2139
-			cur="${cur##*=}"
2140
-			__docker_complete_networks
2141
-			return
2142
-			;;
2143
-		since)
2144
-			cur="${cur##*=}"
2145
-			__docker_complete_containers_all
2146
-			return
2147
-			;;
2148
-		status)
2149
-			COMPREPLY=( $( compgen -W "created dead exited paused restarting running" -- "${cur##*=}" ) )
2150
-			return
2151
-			;;
2152
-		volume)
2153
-			cur="${cur##*=}"
2154
-			__docker_complete_volumes
2155
-			return
2156
-			;;
2157
-	esac
2158
-
2159
-	case "$prev" in
2160
-		--filter|-f)
2161
-			COMPREPLY=( $( compgen -S = -W "ancestor before exited id label name network since status volume" -- "$cur" ) )
2162
-			__docker_nospace
2163
-			return
2164
-			;;
2165
-		--format|-n)
2166
-			return
2167
-			;;
2168
-	esac
2169
-
2170
-	case "$cur" in
2171
-		-*)
2172
-			COMPREPLY=( $( compgen -W "--all -a --filter -f --format --help --latest -l -n --no-trunc --quiet -q --size -s" -- "$cur" ) )
2173
-			;;
2174
-	esac
2175
-}
2176
-
2177
-_docker_pull() {
2178
-	case "$cur" in
2179
-		-*)
2180
-			COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) )
2181
-			;;
2182
-		*)
2183
-			local counter=$(__docker_pos_first_nonflag)
2184
-			if [ $cword -eq $counter ]; then
2185
-				for arg in "${COMP_WORDS[@]}"; do
2186
-					case "$arg" in
2187
-						--all-tags|-a)
2188
-							__docker_complete_image_repos
2189
-							return
2190
-							;;
2191
-					esac
2192
-				done
2193
-				__docker_complete_image_repos_and_tags
2194
-			fi
2195
-			;;
2196
-	esac
2197
-}
2198
-
2199
-_docker_push() {
2200
-	case "$cur" in
2201
-		-*)
2202
-			COMPREPLY=( $( compgen -W "--disable-content-trust=false --help" -- "$cur" ) )
2203
-			;;
2204
-		*)
2205
-			local counter=$(__docker_pos_first_nonflag)
2206
-			if [ $cword -eq $counter ]; then
2207
-				__docker_complete_image_repos_and_tags
2208
-			fi
2209
-			;;
2210
-	esac
2211
-}
2212
-
2213
-_docker_rename() {
2214
-	case "$cur" in
2215
-		-*)
2216
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2217
-			;;
2218
-		*)
2219
-			local counter=$(__docker_pos_first_nonflag)
2220
-			if [ $cword -eq $counter ]; then
2221
-				__docker_complete_containers_all
2222
-			fi
2223
-			;;
2224
-	esac
2225
-}
2226
-
2227
-_docker_restart() {
2228
-	case "$prev" in
2229
-		--time|-t)
2230
-			return
2231
-			;;
2232
-	esac
2233
-
2234
-	case "$cur" in
2235
-		-*)
2236
-			COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) )
2237
-			;;
2238
-		*)
2239
-			__docker_complete_containers_all
2240
-			;;
2241
-	esac
2242
-}
2243
-
2244
-_docker_rm() {
2245
-	case "$cur" in
2246
-		-*)
2247
-			COMPREPLY=( $( compgen -W "--force -f --help --link -l --volumes -v" -- "$cur" ) )
2248
-			;;
2249
-		*)
2250
-			for arg in "${COMP_WORDS[@]}"; do
2251
-				case "$arg" in
2252
-					--force|-f)
2253
-						__docker_complete_containers_all
2254
-						return
2255
-						;;
2256
-				esac
2257
-			done
2258
-			__docker_complete_containers_stopped
2259
-			;;
2260
-	esac
2261
-}
2262
-
2263
-_docker_rmi() {
2264
-	case "$cur" in
2265
-		-*)
2266
-			COMPREPLY=( $( compgen -W "--force -f --help --no-prune" -- "$cur" ) )
2267
-			;;
2268
-		*)
2269
-			__docker_complete_images
2270
-			;;
2271
-	esac
2272
-}
2273
-
2274
-_docker_run() {
2275
-	local options_with_args="
2276
-		--add-host
2277
-		--attach -a
2278
-		--blkio-weight
2279
-		--blkio-weight-device
2280
-		--cap-add
2281
-		--cap-drop
2282
-		--cgroup-parent
2283
-		--cidfile
2284
-		--cpu-period
2285
-		--cpu-quota
2286
-		--cpuset-cpus
2287
-		--cpuset-mems
2288
-		--cpu-shares -c
2289
-		--device
2290
-		--device-read-bps
2291
-		--device-read-iops
2292
-		--device-write-bps
2293
-		--device-write-iops
2294
-		--dns
2295
-		--dns-opt
2296
-		--dns-search
2297
-		--entrypoint
2298
-		--env -e
2299
-		--env-file
2300
-		--expose
2301
-		--group-add
2302
-		--hostname -h
2303
-		--ip
2304
-		--ip6
2305
-		--ipc
2306
-		--isolation
2307
-		--kernel-memory
2308
-		--label-file
2309
-		--label -l
2310
-		--link
2311
-		--link-local-ip
2312
-		--log-driver
2313
-		--log-opt
2314
-		--mac-address
2315
-		--memory -m
2316
-		--memory-swap
2317
-		--memory-swappiness
2318
-		--memory-reservation
2319
-		--name
2320
-		--network
2321
-		--network-alias
2322
-		--oom-score-adj
2323
-		--pid
2324
-		--pids-limit
2325
-		--publish -p
2326
-		--restart
2327
-		--runtime
2328
-		--security-opt
2329
-		--shm-size
2330
-		--stop-signal
2331
-		--storage-opt
2332
-		--tmpfs
2333
-		--sysctl
2334
-		--ulimit
2335
-		--user -u
2336
-		--userns
2337
-		--uts
2338
-		--volume-driver
2339
-		--volumes-from
2340
-		--volume -v
2341
-		--workdir -w
2342
-	"
2343
-
2344
-	local boolean_options="
2345
-		--disable-content-trust=false
2346
-		--help
2347
-		--interactive -i
2348
-		--oom-kill-disable
2349
-		--privileged
2350
-		--publish-all -P
2351
-		--read-only
2352
-		--tty -t
2353
-	"
2354
-
2355
-	if [ "$command" = "run" ] ; then
2356
-		options_with_args="$options_with_args
2357
-			--detach-keys
2358
-			--health-cmd
2359
-			--health-interval
2360
-			--health-retries
2361
-			--health-timeout
2362
-		"
2363
-		boolean_options="$boolean_options
2364
-			--detach -d
2365
-			--no-healthcheck
2366
-			--rm
2367
-			--sig-proxy=false
2368
-		"
2369
-		__docker_complete_detach-keys && return
2370
-	fi
2371
-
2372
-	local all_options="$options_with_args $boolean_options"
2373
-
2374
-
2375
-	__docker_complete_log_driver_options && return
2376
-	__docker_complete_restart && return
2377
-
2378
-	local key=$(__docker_map_key_of_current_option '--security-opt')
2379
-	case "$key" in
2380
-		label)
2381
-			[[ $cur == *: ]] && return
2382
-			COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "${cur##*=}") )
2383
-			if [ "${COMPREPLY[*]}" != "disable" ] ; then
2384
-				__docker_nospace
2385
-			fi
2386
-			return
2387
-			;;
2388
-		seccomp)
2389
-			local cur=${cur##*=}
2390
-			_filedir
2391
-			COMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) )
2392
-			return
2393
-			;;
2394
-	esac
2395
-
2396
-	case "$prev" in
2397
-		--add-host)
2398
-			case "$cur" in
2399
-				*:)
2400
-					__docker_complete_resolved_hostname
2401
-					return
2402
-					;;
2403
-			esac
2404
-			;;
2405
-		--attach|-a)
2406
-			COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) )
2407
-			return
2408
-			;;
2409
-		--cap-add|--cap-drop)
2410
-			__docker_complete_capabilities
2411
-			return
2412
-			;;
2413
-		--cidfile|--env-file|--label-file)
2414
-			_filedir
2415
-			return
2416
-			;;
2417
-		--device|--tmpfs|--volume|-v)
2418
-			case "$cur" in
2419
-				*:*)
2420
-					# TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine)
2421
-					;;
2422
-				'')
2423
-					COMPREPLY=( $( compgen -W '/' -- "$cur" ) )
2424
-					__docker_nospace
2425
-					;;
2426
-				/*)
2427
-					_filedir
2428
-					__docker_nospace
2429
-					;;
2430
-			esac
2431
-			return
2432
-			;;
2433
-		--env|-e)
2434
-			COMPREPLY=( $( compgen -e -- "$cur" ) )
2435
-			__docker_nospace
2436
-			return
2437
-			;;
2438
-		--ipc)
2439
-			case "$cur" in
2440
-				*:*)
2441
-					cur="${cur#*:}"
2442
-					__docker_complete_containers_running
2443
-					;;
2444
-				*)
2445
-					COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) )
2446
-					if [ "$COMPREPLY" = "container:" ]; then
2447
-						__docker_nospace
2448
-					fi
2449
-					;;
2450
-			esac
2451
-			return
2452
-			;;
2453
-		--isolation)
2454
-			__docker_complete_isolation
2455
-			return
2456
-			;;
2457
-		--link)
2458
-			case "$cur" in
2459
-				*:*)
2460
-					;;
2461
-				*)
2462
-					__docker_complete_containers_running
2463
-					COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
2464
-					__docker_nospace
2465
-					;;
2466
-			esac
2467
-			return
2468
-			;;
2469
-		--log-driver)
2470
-			__docker_complete_log_drivers
2471
-			return
2472
-			;;
2473
-		--log-opt)
2474
-			__docker_complete_log_options
2475
-			return
2476
-			;;
2477
-		--network)
2478
-			case "$cur" in
2479
-				container:*)
2480
-					local cur=${cur#*:}
2481
-					__docker_complete_containers_all
2482
-					;;
2483
-				*)
2484
-					COMPREPLY=( $( compgen -W "$(__docker_plugins Network) $(__docker_networks) container:" -- "$cur") )
2485
-					if [ "${COMPREPLY[*]}" = "container:" ] ; then
2486
-						__docker_nospace
2487
-					fi
2488
-					;;
2489
-			esac
2490
-			return
2491
-			;;
2492
-		--pid)
2493
-			case "$cur" in
2494
-				*:*)
2495
-					cur="${cur#*:}"
2496
-					__docker_complete_containers_running
2497
-					;;
2498
-				*)
2499
-					COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) )
2500
-					if [ "$COMPREPLY" = "container:" ]; then
2501
-						__docker_nospace
2502
-					fi
2503
-					;;
2504
-			esac
2505
-			return
2506
-			;;
2507
-		--runtime)
2508
-			__docker_complete_runtimes
2509
-			return
2510
-			;;
2511
-		--security-opt)
2512
-			COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )
2513
-			if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then
2514
-				__docker_nospace
2515
-			fi
2516
-			return
2517
-			;;
2518
-		--storage-opt)
2519
-			COMPREPLY=( $( compgen -W "size" -S = -- "$cur") )
2520
-			__docker_nospace
2521
-			return
2522
-			;;
2523
-		--user|-u)
2524
-			__docker_complete_user_group
2525
-			return
2526
-			;;
2527
-		--userns)
2528
-			COMPREPLY=( $( compgen -W "host" -- "$cur" ) )
2529
-			return
2530
-			;;
2531
-		--volume-driver)
2532
-			__docker_complete_plugins Volume
2533
-			return
2534
-			;;
2535
-		--volumes-from)
2536
-			__docker_complete_containers_all
2537
-			return
2538
-			;;
2539
-		$(__docker_to_extglob "$options_with_args") )
2540
-			return
2541
-			;;
2542
-	esac
2543
-
2544
-	case "$cur" in
2545
-		-*)
2546
-			COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
2547
-			;;
2548
-		*)
2549
-			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
2550
-			if [ $cword -eq $counter ]; then
2551
-				__docker_complete_images
2552
-			fi
2553
-			;;
2554
-	esac
2555
-}
2556
-
2557
-_docker_save() {
2558
-	case "$prev" in
2559
-		--output|-o)
2560
-			_filedir
2561
-			return
2562
-			;;
2563
-	esac
2564
-
2565
-	case "$cur" in
2566
-		-*)
2567
-			COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) )
2568
-			;;
2569
-		*)
2570
-			__docker_complete_images
2571
-			;;
2572
-	esac
2573
-}
2574
-
2575
-_docker_search() {
2576
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
2577
-	case "$key" in
2578
-		is-automated)
2579
-			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
2580
-			return
2581
-			;;
2582
-		is-official)
2583
-			COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
2584
-			return
2585
-			;;
2586
-	esac
2587
-
2588
-	case "$prev" in
2589
-		--filter|-f)
2590
-			COMPREPLY=( $( compgen -S = -W "is-automated is-official stars" -- "$cur" ) )
2591
-			__docker_nospace
2592
-			return
2593
-			;;
2594
-		--limit)
2595
-			return
2596
-			;;
2597
-	esac
2598
-
2599
-	case "$cur" in
2600
-		-*)
2601
-			COMPREPLY=( $( compgen -W "--filter --help --limit --no-trunc" -- "$cur" ) )
2602
-			;;
2603
-	esac
2604
-}
2605
-
2606
-_docker_start() {
2607
-	__docker_complete_detach-keys && return
2608
-
2609
-	case "$cur" in
2610
-		-*)
2611
-			COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) )
2612
-			;;
2613
-		*)
2614
-			__docker_complete_containers_stopped
2615
-			;;
2616
-	esac
2617
-}
2618
-
2619
-_docker_stats() {
2620
-	case "$cur" in
2621
-		-*)
2622
-			COMPREPLY=( $( compgen -W "--all -a --help --no-stream" -- "$cur" ) )
2623
-			;;
2624
-		*)
2625
-			__docker_complete_containers_running
2626
-			;;
2627
-	esac
2628
-}
2629
-
2630
-_docker_stop() {
2631
-	case "$prev" in
2632
-		--time|-t)
2633
-			return
2634
-			;;
2635
-	esac
2636
-
2637
-	case "$cur" in
2638
-		-*)
2639
-			COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) )
2640
-			;;
2641
-		*)
2642
-			__docker_complete_containers_running
2643
-			;;
2644
-	esac
2645
-}
2646
-
2647
-_docker_tag() {
2648
-	case "$cur" in
2649
-		-*)
2650
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2651
-			;;
2652
-		*)
2653
-			local counter=$(__docker_pos_first_nonflag)
2654
-
2655
-			if [ $cword -eq $counter ]; then
2656
-				__docker_complete_image_repos_and_tags
2657
-				return
2658
-			fi
2659
-			(( counter++ ))
2660
-
2661
-			if [ $cword -eq $counter ]; then
2662
-				__docker_complete_image_repos_and_tags
2663
-				return
2664
-			fi
2665
-			;;
2666
-	esac
2667
-}
2668
-
2669
-_docker_unpause() {
2670
-	case "$cur" in
2671
-		-*)
2672
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2673
-			;;
2674
-		*)
2675
-			local counter=$(__docker_pos_first_nonflag)
2676
-			if [ $cword -eq $counter ]; then
2677
-				__docker_complete_containers_unpauseable
2678
-			fi
2679
-			;;
2680
-	esac
2681
-}
2682
-
2683
-_docker_update() {
2684
-	local options_with_args="
2685
-		--blkio-weight
2686
-		--cpu-period
2687
-		--cpu-quota
2688
-		--cpuset-cpus
2689
-		--cpuset-mems
2690
-		--cpu-shares -c
2691
-		--kernel-memory
2692
-		--memory -m
2693
-		--memory-reservation
2694
-		--memory-swap
2695
-		--restart
2696
-	"
2697
-
2698
-	local boolean_options="
2699
-		--help
2700
-	"
2701
-
2702
-	local all_options="$options_with_args $boolean_options"
2703
-
2704
-	__docker_complete_restart && return
2705
-
2706
-	case "$prev" in
2707
-		$(__docker_to_extglob "$options_with_args") )
2708
-			return
2709
-			;;
2710
-	esac
2711
-
2712
-	case "$cur" in
2713
-		-*)
2714
-			COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
2715
-			;;
2716
-		*)
2717
-			__docker_complete_containers_all
2718
-			;;
2719
-	esac
2720
-}
2721
-
2722
-_docker_top() {
2723
-	case "$cur" in
2724
-		-*)
2725
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2726
-			;;
2727
-		*)
2728
-			local counter=$(__docker_pos_first_nonflag)
2729
-			if [ $cword -eq $counter ]; then
2730
-				__docker_complete_containers_running
2731
-			fi
2732
-			;;
2733
-	esac
2734
-}
2735
-
2736
-_docker_version() {
2737
-	case "$cur" in
2738
-		-*)
2739
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2740
-			;;
2741
-	esac
2742
-}
2743
-
2744
-_docker_volume_create() {
2745
-	case "$prev" in
2746
-		--driver|-d)
2747
-			__docker_complete_plugins Volume
2748
-			return
2749
-			;;
2750
-		--label|--name|--opt|-o)
2751
-			return
2752
-			;;
2753
-	esac
2754
-
2755
-	case "$cur" in
2756
-		-*)
2757
-			COMPREPLY=( $( compgen -W "--driver -d --help --label --name --opt -o" -- "$cur" ) )
2758
-			;;
2759
-	esac
2760
-}
2761
-
2762
-_docker_volume_inspect() {
2763
-	case "$prev" in
2764
-		--format|-f)
2765
-			return
2766
-			;;
2767
-	esac
2768
-
2769
-	case "$cur" in
2770
-		-*)
2771
-			COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) )
2772
-			;;
2773
-		*)
2774
-			__docker_complete_volumes
2775
-			;;
2776
-	esac
2777
-}
2778
-
2779
-_docker_volume_ls() {
2780
-	local key=$(__docker_map_key_of_current_option '--filter|-f')
2781
-	case "$key" in
2782
-		dangling)
2783
-			COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) )
2784
-			return
2785
-			;;
2786
-		driver)
2787
-			cur=${cur##*=}
2788
-			__docker_complete_plugins Volume
2789
-			return
2790
-			;;
2791
-		name)
2792
-			cur=${cur##*=}
2793
-			__docker_complete_volumes
2794
-			return
2795
-			;;
2796
-	esac
2797
-
2798
-	case "$prev" in
2799
-		--filter|-f)
2800
-			COMPREPLY=( $( compgen -S = -W "dangling driver name" -- "$cur" ) )
2801
-			__docker_nospace
2802
-			return
2803
-			;;
2804
-	esac
2805
-
2806
-	case "$cur" in
2807
-		-*)
2808
-			COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) )
2809
-			;;
2810
-	esac
2811
-}
2812
-
2813
-_docker_volume_rm() {
2814
-	case "$cur" in
2815
-		-*)
2816
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2817
-			;;
2818
-		*)
2819
-			__docker_complete_volumes
2820
-			;;
2821
-	esac
2822
-}
2823
-
2824
-_docker_volume() {
2825
-	local subcommands="
2826
-		create
2827
-		inspect
2828
-		ls
2829
-		rm
2830
-	"
2831
-	__docker_subcommands "$subcommands" && return
2832
-
2833
-	case "$cur" in
2834
-		-*)
2835
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2836
-			;;
2837
-		*)
2838
-			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
2839
-			;;
2840
-	esac
2841
-}
2842
-
2843
-_docker_wait() {
2844
-	case "$cur" in
2845
-		-*)
2846
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
2847
-			;;
2848
-		*)
2849
-			__docker_complete_containers_all
2850
-			;;
2851
-	esac
2852
-}
2853
-
2854
-_docker() {
2855
-	local previous_extglob_setting=$(shopt -p extglob)
2856
-	shopt -s extglob
2857
-
2858
-	local commands=(
2859
-		attach
2860
-		build
2861
-		commit
2862
-		cp
2863
-		create
2864
-		daemon
2865
-		diff
2866
-		events
2867
-		exec
2868
-		export
2869
-		history
2870
-		images
2871
-		import
2872
-		info
2873
-		inspect
2874
-		kill
2875
-		load
2876
-		login
2877
-		logout
2878
-		logs
2879
-		network
2880
-		node
2881
-		pause
2882
-		port
2883
-		ps
2884
-		pull
2885
-		push
2886
-		rename
2887
-		restart
2888
-		rm
2889
-		rmi
2890
-		run
2891
-		save
2892
-		search
2893
-		service
2894
-		start
2895
-		stats
2896
-		stop
2897
-		swarm
2898
-		tag
2899
-		top
2900
-		unpause
2901
-		update
2902
-		version
2903
-		volume
2904
-		wait
2905
-	)
2906
-
2907
-	# These options are valid as global options for all client commands
2908
-	# and valid as command options for `docker daemon`
2909
-	local global_boolean_options="
2910
-		--debug -D
2911
-		--tls
2912
-		--tlsverify
2913
-	"
2914
-	local global_options_with_args="
2915
-		--config
2916
-		--host -H
2917
-		--log-level -l
2918
-		--tlscacert
2919
-		--tlscert
2920
-		--tlskey
2921
-	"
2922
-
2923
-	local host config
2924
-
2925
-	COMPREPLY=()
2926
-	local cur prev words cword
2927
-	_get_comp_words_by_ref -n : cur prev words cword
2928
-
2929
-	local command='docker' command_pos=0 subcommand_pos
2930
-	local counter=1
2931
-	while [ $counter -lt $cword ]; do
2932
-		case "${words[$counter]}" in
2933
-			# save host so that completion can use custom daemon
2934
-			--host|-H)
2935
-				(( counter++ ))
2936
-				host="${words[$counter]}"
2937
-				;;
2938
-			# save config so that completion can use custom configuration directories
2939
-			--config)
2940
-				(( counter++ ))
2941
-				config="${words[$counter]}"
2942
-				;;
2943
-			$(__docker_to_extglob "$global_options_with_args") )
2944
-				(( counter++ ))
2945
-				;;
2946
-			-*)
2947
-				;;
2948
-			=)
2949
-				(( counter++ ))
2950
-				;;
2951
-			*)
2952
-				command="${words[$counter]}"
2953
-				command_pos=$counter
2954
-				break
2955
-				;;
2956
-		esac
2957
-		(( counter++ ))
2958
-	done
2959
-
2960
-	local binary="${words[0]}"
2961
-	if [[ $binary == ?(*/)dockerd ]] ; then
2962
-		# for the dockerd binary, we reuse completion of `docker daemon`.
2963
-		# dockerd does not have subcommands and global options.
2964
-		command=daemon
2965
-		command_pos=0
2966
-	fi
2967
-
2968
-	local completions_func=_docker_${command}
2969
-	declare -F $completions_func >/dev/null && $completions_func
2970
-
2971
-	eval "$previous_extglob_setting"
2972
-	return 0
2973
-}
2974
-
2975
-eval "$__docker_previous_extglob_setting"
2976
-unset __docker_previous_extglob_setting
2977
-
2978
-complete -F _docker docker dockerd
2979 1
deleted file mode 100644
... ...
@@ -1,13 +0,0 @@
1
-[Unit]
2
-Description=Containerd Daemon
3
-Documentation=https://containerd.tools/
4
-After=network.target
5
-
6
-[Service]
7
-ExecStart=/usr/bin/docker-containerd --listen unix:///run/containerd.sock --runtime /usr/bin/docker-runc --shim /usr/bin/docker-containerd-shim
8
-LimitNOFILE=1048576
9
-LimitNPROC=1048576
10
-LimitCORE=infinity
11
-
12
-[Install]
13
-WantedBy=multi-user.target
14 1
deleted file mode 100644
... ...
@@ -1,21 +0,0 @@
1
-[Unit]
2
-Description=Docker Daemon
3
-Documentation=http://docs.docker.com
4
-Wants=network-online.target
5
-After=network-online.target docker-containerd.service
6
-Requires=docker-containerd.service
7
-
8
-[Service]
9
-Type=notify
10
-EnvironmentFile=-/etc/default/docker
11
-ExecStart=/usr/bin/docker daemon $DOCKER_OPTS \
12
-          --containerd /run/containerd.sock
13
-ExecReload=/bin/kill -HUP $MAINPID
14
-KillMode=process
15
-Restart=on-abnormal
16
-LimitNOFILE=1048576
17
-LimitNPROC=1048576
18
-LimitCORE=infinity
19
-
20
-[Install]
21
-WantedBy=multi-user.target
... ...
@@ -1,23 +1,30 @@
1
+%define debug_package %{nil}
2
+%define __os_install_post %{nil}
1 3
 Summary:        Docker
2 4
 Name:           docker
3
-Version:        1.13.1
4
-Release:        4%{?dist}
5
+Version:        17.06.0
6
+Release:        1%{?dist}
5 7
 License:        ASL 2.0
6 8
 URL:            http://docs.docker.com
7 9
 Group:          Applications/File
8 10
 Vendor:         VMware, Inc.
9 11
 Distribution:   Photon
10
-Source0:        https://github.com/docker/docker/archive/%{name}-%{version}.tar.gz
11
-%define sha1 docker=8a39c44c9e665495484fd86fbefdfbc9ab9d815d 
12
-Source1:        https://github.com/docker/containerd/archive/containerd-0.2.5.tar.gz
13
-%define sha1 containerd=aaf6fd1c5176b8575af1d8edf82af3d733528451
14
-Source2:        https://github.com/opencontainers/runc/tree/runc-1.0.0-rc2-9df8b306d01f59d3a8029be411de015b7304dd8f.zip
15
-%define sha1 runc=8f66277f75bafebe564226d8a3107a19d60b3237
16
-Source3:        https://github.com/docker/libnetwork/archive/docker-libnetwork-master-0.8.1.tar.gz
17
-%define sha1 docker-libnetwork-master=231c59f72a17f5e3f33e75e1efa164623e1852d8
18
-Source4:        docker.service
19
-Source5:        docker-containerd.service
20
-Source6:        docker-completion.bash
12
+#Git commits must be in sync with docker/hack/dockerfile/binaries-commits
13
+Source0:        https://github.com/docker/moby/archive/docker-ce-02c1d87.tar.gz
14
+%define sha1 docker-ce=40deab51330b39d16abc23831063a6123ff0a570
15
+Source1:        https://github.com/docker/containerd/tree/containerd-cfb82a8.tar.gz
16
+%define sha1 containerd=2adb56ddd2d89af5c6ab649de93c34d421b62649
17
+Source2:        https://github.com/docker/runc/tree/runc-2d41c04.tar.gz
18
+%define sha1 runc=41cd104b168cef29032c268e0d6de1bad5dadc25
19
+Source3:        https://github.com/docker/libnetwork/tree/libnetwork-7b2b1fe.tar.gz
20
+%define sha1 libnetwork=0afeb8c802998344753fb933f827427da23975f8
21
+#Source4:        https://github.com/docker/cli/tree/cli-3dfb834.tar.gz
22
+#%define sha1 cli=9dd33ca7d8e554fe875138000c6767167228e125
23
+Source4:        https://github.com/krallin/tini/tree/tini-949e6fa.tar.gz
24
+%define sha1 tini=e1a0e72ff74e1486e0701dd52983014777a7d949
25
+Source5:        https://github.com/cpuguy83/go-md2man/tree/go-md2man-a65d4d2.tar.gz
26
+%define sha1 go-md2man=e3d0865c583150f7c76e385a8b4a3f2432ca8ad8
27
+Patch0:         remove-firewalld.patch
21 28
 
22 29
 BuildRequires:  systemd
23 30
 BuildRequires:  systemd-devel
... ...
@@ -25,8 +32,16 @@ BuildRequires:  device-mapper-devel
25 25
 BuildRequires:  btrfs-progs-devel
26 26
 BuildRequires:  libseccomp
27 27
 BuildRequires:  libseccomp-devel
28
+BuildRequires:  libltdl-devel
29
+BuildRequires:  libgcc-devel
30
+BuildRequires:  glibc-devel
28 31
 BuildRequires:  unzip
29 32
 BuildRequires:  go
33
+BuildRequires:  sed
34
+BuildRequires:  cmake
35
+BuildRequires:  findutils
36
+BuildRequires:  git
37
+Requires:       libltdl
30 38
 Requires:       libgcc
31 39
 Requires:       glibc
32 40
 Requires:       libseccomp
... ...
@@ -35,78 +50,139 @@ Requires:       device-mapper-libs
35 35
 
36 36
 %description
37 37
 Docker is a platform for developers and sysadmins to develop, ship and run applications.
38
+
39
+%package        doc
40
+Summary:        Documentation and vimfiles for docker
41
+Requires:       %{name} = %{version}
42
+
43
+%description    doc
44
+Documentation and vimfiles for docker
45
+
38 46
 %prep
39
-%setup -q
47
+%setup -q -c
40 48
 %setup -T -D -a 1
41 49
 %setup -T -D -a 2
42 50
 %setup -T -D -a 3
51
+%setup -T -D -a 4
52
+%setup -T -D -a 5
43 53
 
44
-%build
54
+ln -s docker-ce/components/cli cli
55
+ln -s docker-ce/components/engine engine
56
+ln -s docker-ce/components/packaging packaging
45 57
 
46
-export AUTO_GOPATH=1
47
-export DOCKER_BUILDTAGS='exclude_graphdriver_aufs'
48
-export DOCKER_GITCOMMIT="092cba3"
58
+%patch0 -p2
49 59
 
50
-./hack/make.sh dynbinary
60
+mkdir -p /go/src/github.com
61
+cd /go/src/github.com
62
+mkdir opencontainers
63
+mkdir containerd
64
+mkdir cpuguy83
65
+mkdir docker
51 66
 
52
-mkdir -p /usr/share/gocode/src/github.com/docker/
53
-cd /usr/share/gocode/src/github.com/docker/
54
-mv /usr/src/photon/BUILD/docker-1.13.1/containerd-0.2.5 .
55
-mv containerd-0.2.5 containerd
56
-cd containerd
67
+ln -snrf "$OLDPWD/containerd" containerd/
68
+ln -snrf "$OLDPWD/engine" docker/docker
69
+ln -snrf "$OLDPWD/runc" opencontainers/
70
+ln -snrf "$OLDPWD/go-md2man" cpuguy83/
71
+ln -snrf "$OLDPWD/libnetwork" docker/
72
+ln -snrf "$OLDPWD/cli" docker/
57 73
 
58
-make
74
+ln -snrf "$OLDPWD/tini" /go/
59 75
 
60
-mkdir -p /usr/share/gocode/src/github.com/opencontainers/
61
-cd /usr/share/gocode/src/github.com/opencontainers/
62
-mv /usr/src/photon/BUILD/docker-1.13.1/runc-9df8b306d01f59d3a8029be411de015b7304dd8f .
63
-mv runc-9df8b306d01f59d3a8029be411de015b7304dd8f runc
64
-cd runc
65
-make BUILDTAGS='seccomp'
76
+sed -i '/^\s*git clone.*$/d' docker/docker/hack/dockerfile/install-binaries.sh
77
+
78
+#catch git clone
79
+git config --global http.proxy http://localhost:0
80
+
81
+%build
66 82
 
67
-cd /usr/share/gocode/src/github.com/docker/
68
-mv /usr/src/photon/BUILD/docker-1.13.1/libnetwork-master/ .
69
-mv libnetwork-master libnetwork
70
-cd libnetwork
71
-go build -ldflags="-linkmode=external" -o docker-proxy github.com/docker/libnetwork/cmd/proxy
83
+export GOPATH="/go"
84
+export PATH="$PATH:$GOPATH/bin"
85
+
86
+export DOCKER_BUILDTAGS="pkcs11 seccomp exclude_graphdriver_aufs"
87
+export RUNC_BUILDTAGS="seccomp"
88
+
89
+cd /go/src/github.com
90
+
91
+pushd docker/cli
92
+make VERSION="$(cat VERSION)" dynbinary manpages
93
+popd
94
+
95
+pushd docker/docker
96
+TMP_GOPATH="$GOPATH" ./hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic proxy-dynamic tini
97
+DOCKER_GITCOMMIT="$(git rev-parse --short HEAD)" ./hack/make.sh dynbinary
98
+popd
72 99
 
73 100
 %install
74
-install -vdm755 %{buildroot}/usr/bin
75
-mv -v %{_builddir}/%{name}-%{version}/bundles/latest/dynbinary-client/%{name}-%{version} %{buildroot}/usr/bin/%{name}
76
-mv -v %{_builddir}/%{name}-%{version}/bundles/latest/dynbinary-daemon/%{name}d-%{version} %{buildroot}/usr/bin/%{name}d
77
-mv -v /usr/share/gocode/src/github.com/docker/containerd/bin/containerd %{buildroot}/usr/bin/%{name}-containerd
78
-mv -v /usr/share/gocode/src/github.com/docker/containerd/bin/containerd-shim %{buildroot}/usr/bin/%{name}-containerd-shim
79
-mv -v /usr/share/gocode/src/github.com/docker/containerd/bin/ctr %{buildroot}/usr/bin/%{name}-containerd-ctr
80
-mv -v /usr/share/gocode/src/github.com/opencontainers/runc/runc %{buildroot}/usr/bin/%{name}-runc
81
-mv -v /usr/share/gocode/src/github.com/docker/libnetwork/docker-proxy %{buildroot}/usr/bin/%{name}-proxy
82
-install -vd %{buildroot}/lib/systemd/system
83
-cp %{SOURCE4} %{buildroot}/lib/systemd/system/docker.service
84
-cp %{SOURCE5} %{buildroot}/lib/systemd/system/docker-containerd.service
85
-install -vdm 755 %{buildroot}%{_datadir}/bash-completion/completions
86
-install -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/bash-completion/completions/docker
87
-
88
-%{_fixperms} %{buildroot}/*
101
+
102
+install -d -m755 %{buildroot}%{_mandir}/man1
103
+install -d -m755 %{buildroot}%{_mandir}/man5
104
+install -d -m755 %{buildroot}%{_mandir}/man8
105
+install -d -m755 %{buildroot}%{_bindir}
106
+install -d -m755 %{buildroot}%{_unitdir}
107
+install -d -m755 %{buildroot}lib/udev/rules.d
108
+install -d -m755 %{buildroot}%{_datadir}/bash-completion/completions
109
+
110
+# install binary
111
+install -p -m 755 cli/build/docker %{buildroot}%{_bindir}/docker
112
+install -p -m 755 "$(readlink -f engine/bundles/latest/dynbinary-daemon/dockerd)" %{buildroot}%{_bindir}/dockerd
113
+
114
+# install proxy
115
+install -p -m 755 /usr/local/bin/docker-proxy %{buildroot}%{_bindir}/docker-proxy
116
+
117
+# install containerd
118
+install -p -m 755 /usr/local/bin/docker-containerd %{buildroot}%{_bindir}/docker-containerd
119
+install -p -m 755 /usr/local/bin/docker-containerd-shim %{buildroot}%{_bindir}/docker-containerd-shim
120
+install -p -m 755 /usr/local/bin/docker-containerd-ctr %{buildroot}%{_bindir}/docker-containerd-ctr
121
+
122
+# install runc
123
+install -p -m 755 /usr/local/bin/docker-runc %{buildroot}%{_bindir}/docker-runc
124
+
125
+# install tini
126
+install -p -m 755 /usr/local/bin/docker-init %{buildroot}%{_bindir}/docker-init
127
+
128
+# install udev rules
129
+install -p -m 644 engine/contrib/udev/80-docker.rules %{buildroot}lib/udev/rules.d/80-docker.rules
130
+
131
+# add init scripts
132
+install -p -m 644 packaging/rpm/systemd/docker.service %{buildroot}%{_unitdir}/docker.service
133
+
134
+# add bash, zsh, and fish completions
135
+install -p -m 644 engine/contrib/completion/bash/docker %{buildroot}%{_datadir}/bash-completion/completions/docker
136
+
137
+# install manpages
138
+install -p -m 644 cli/man/man1/*.1 %{buildroot}%{_mandir}/man1
139
+install -p -m 644 cli/man/man5/*.5 %{buildroot}%{_mandir}/man5
140
+install -p -m 644 cli/man/man8/*.8 %{buildroot}%{_mandir}/man8
141
+
142
+# add vimfiles
143
+install -d -m 755 %{buildroot}%{_datadir}/vim/vimfiles/doc
144
+install -d -m 755 %{buildroot}%{_datadir}/vim/vimfiles/ftdetect
145
+install -d -m 755 %{buildroot}%{_datadir}/vim/vimfiles/syntax
146
+install -p -m 644 engine/contrib/syntax/vim/doc/dockerfile.txt %{buildroot}%{_datadir}/vim/vimfiles/doc/dockerfile.txt
147
+install -p -m 644 engine/contrib/syntax/vim/ftdetect/dockerfile.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/dockerfile.vim
148
+install -p -m 644 engine/contrib/syntax/vim/syntax/dockerfile.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/dockerfile.vim
149
+
150
+mkdir -p build-docs
151
+for engine_file in AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md; do
152
+    cp "engine/$engine_file" "build-docs/engine-$engine_file"
153
+done
154
+for cli_file in LICENSE MAINTAINERS NOTICE README.md; do
155
+    cp "cli/$cli_file" "build-docs/cli-$cli_file"
156
+done
89 157
 
90 158
 %preun
91 159
 %systemd_preun docker.service
92
-%systemd_preun docker-containerd.service
93 160
 
94 161
 %post
95
-/sbin/ldconfig
96
-
97 162
 if [ $1 -eq 1 ] ; then
98
-    getent group  docker  >/dev/null || groupadd -r docker
163
+    getent group docker >/dev/null || groupadd -r docker
99 164
 fi
100 165
 
101 166
 %postun
102
-/sbin/ldconfig
103
-%systemd_postun_with_restart docker-containerd.service
104 167
 %systemd_postun_with_restart docker.service
105 168
 
106 169
 if [ $1 -eq 0 ] ; then
107
-    if getent group docker >/dev/null; then
108
-        groupdel docker
109
-    fi
170
+    getent group docker >/dev/null && groupdel docker
110 171
 fi
111 172
 
112 173
 %clean
... ...
@@ -114,19 +190,32 @@ rm -rf %{buildroot}/*
114 114
 
115 115
 %files
116 116
 %defattr(-,root,root)
117
-/lib/systemd/system/docker-containerd.service
118
-/lib/systemd/system/docker.service
119
-/usr/bin
120
-/usr/bin/docker
121
-/usr/bin/docker-containerd
122
-/usr/bin/docker-containerd-ctr
123
-/usr/bin/docker-containerd-shim
124
-/usr/bin/docker-proxy
125
-/usr/bin/docker-runc
126
-/usr/bin/dockerd
127
-/usr/share/bash-completion/completions/docker
117
+%{_unitdir}/docker.service
118
+%{_bindir}/docker
119
+%{_bindir}/dockerd
120
+%{_bindir}/docker-containerd
121
+%{_bindir}/docker-containerd-ctr
122
+%{_bindir}/docker-containerd-shim
123
+%{_bindir}/docker-proxy
124
+%{_bindir}/docker-runc
125
+%{_bindir}/docker-init
126
+%{_datadir}/bash-completion/completions/docker
127
+
128
+%files doc
129
+%defattr(-,root,root)
130
+%doc build-docs/engine-AUTHORS build-docs/engine-CHANGELOG.md build-docs/engine-CONTRIBUTING.md build-docs/engine-LICENSE build-docs/engine-MAINTAINERS build-docs/engine-NOTICE build-docs/engine-README.md
131
+%doc build-docs/cli-LICENSE build-docs/cli-MAINTAINERS build-docs/cli-NOTICE build-docs/cli-README.md
132
+%doc
133
+%{_mandir}/man1/*
134
+%{_mandir}/man5/*
135
+%{_mandir}/man8/*
136
+%{_datadir}/vim/vimfiles/doc/dockerfile.txt
137
+%{_datadir}/vim/vimfiles/ftdetect/dockerfile.vim
138
+%{_datadir}/vim/vimfiles/syntax/dockerfile.vim
128 139
 
129 140
 %changelog
141
+*   Tue Jul 18 2017 Bo Gan <ganb@vmware.com> 17.06.0-1
142
+-   Update to 17.06.0-ce
130 143
 *   Thu May 04 2017 Kumar Kaushik <kaushikk@vmware.com> 1.13.1-4
131 144
 -   Adding build requires GO.
132 145
 *   Wed May 03 2017 Kumar Kaushik <kaushikk@vmware.com> 1.13.1-3
133 146
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+diff --git a/components/packaging/rpm/systemd/docker.service b/components/packaging/rpm/systemd/docker.service
1
+index 6c60646..a10146d 100644
2
+--- a/components/packaging/rpm/systemd/docker.service
3
+@@ -1,7 +1,7 @@
4
+ [Unit]
5
+ Description=Docker Application Container Engine
6
+ Documentation=https://docs.docker.com
7
+-After=network-online.target firewalld.service
8
++After=network-online.target
9
+ Wants=network-online.target
10
+ 
11
+ [Service]
... ...
@@ -22,7 +22,7 @@ cat <<EOF > `dirname $(gcc --print-libgcc-file-name)`/../specs
22 22
 
23 23
 # sec hardening flags require shared libgcc_s during linking.
24 24
 *libgcc:
25
-+ --as-needed -lgcc_s --no-as-needed
25
++ %{!static:--as-needed -lgcc_s --no-as-needed}
26 26
 
27 27
 # replace default startfile rules to use crt that PIE code requires.
28 28
 *startfile:
... ...
@@ -41,7 +41,7 @@ else
41 41
 cat <<EOF >> `dirname $(gcc --print-libgcc-file-name)`/../specs
42 42
 # add sec hardening flags for linker.
43 43
 *link:
44
-+ %{r|nostdlib|fno-pie|fno-PIE|fno-pic|fno-PIC|shared:;:-pie} %{!norelro:-z relro} %{!nonow:-z now}
44
++ %{r|nostdlib|fno-pie|fno-PIE|fno-pic|fno-PIC|shared|static:;:-pie} %{!norelro:-z relro} %{!nonow:-z now}
45 45
 
46 46
 EOF
47 47
 fi
48 48
new file mode 100755
... ...
@@ -0,0 +1,34 @@
0
+#!/bin/bash
1
+
2
+if [[ $# != 2 ]]; then
3
+  echo "${0} <repo> <tag>"
4
+  exit 1
5
+fi
6
+
7
+set -x
8
+set -e
9
+
10
+REPO="$1"
11
+TAG="$2"
12
+DIR="$(basename "$REPO")"
13
+DIR="${DIR%.*}"
14
+TMP="$(mktemp -d "/tmp/git-repo-XXXX")"
15
+trap "{ rm -rf "$TMP"; }" EXIT 
16
+
17
+mkdir -p "$TMP/$DIR"
18
+pushd "$TMP"
19
+#phase 1: clone the repo
20
+git clone "$REPO" "${DIR}-orig"
21
+#phase 2: clone again with the tag/commit only
22
+cd "$DIR"
23
+git init --template=/dev/null
24
+git remote add origin "../${DIR}-orig"
25
+git fetch origin "$TAG" --depth=1
26
+git checkout FETCH_HEAD
27
+git gc --aggressive --prune=now
28
+COMMIT="$(git rev-parse --short HEAD)"
29
+cd ..
30
+du -xhd1
31
+popd
32
+
33
+tar -czf "$DIR-$COMMIT.tar.gz" -C "$TMP" "$DIR"