-
Notifications
You must be signed in to change notification settings - Fork 17
/
docker-compose.sh
465 lines (428 loc) · 19.7 KB
/
docker-compose.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
#!/usr/bin/env bash
# Automatic generated, DON'T MODIFY IT.
# @flag --all-resources Include all resources, even those not used by services
# @option --ansi[never|always|auto] <string> Control when to print ANSI control characters (default "auto")
# @flag --compatibility Run compose in backward compatibility mode
# @flag --dry-run Execute command in dry run mode
# @option --env-file* <file> Specify an alternate environment file
# @option -f --file* <file> Compose configuration files
# @option --parallel <int> Control max parallelism, -1 for unlimited (default -1)
# @option --profile* <file> Specify a profile to enable
# @option --progress[auto|tty|plain|json|quiet] <string> Set type of progress output (default "auto")
# @option --project-directory <path> Specify an alternate working directory (default: the path of the, first specified, Compose file)
# @option -p --project-name <string> Project name
# {{ docker-compose attach
# @cmd Attach local standard input, output, and error streams to a service's running container
# @option --detach-keys <string> Override the key sequence for detaching from a container.
# @flag --dry-run Execute command in dry run mode
# @option --index <int> index of the container if service has multiple replicas.
# @flag --no-stdin Do not attach STDIN
# @flag --sig-proxy Proxy all received signals to the process (default true)
# @arg service[`_choice_service`]
attach() {
:;
}
# }} docker-compose attach
# {{ docker-compose build
# @cmd Build or rebuild services
# @option --build-arg* <string> Set build-time variables for services
# @option --builder <string> Set builder to use
# @flag --dry-run Execute command in dry run mode
# @option -m --memory <bytes> Set memory limit for the build container.
# @flag --no-cache Do not use cache when building the image
# @flag --pull Always attempt to pull a newer version of the image
# @flag --push Push service images
# @flag -q --quiet Don't print anything to STDOUT
# @option --ssh <string> Set SSH authentications used when building service images.
# @flag --with-dependencies Also build dependencies (transitively)
# @arg service*[`_choice_service`]
build() {
:;
}
# }} docker-compose build
# {{ docker-compose config
# @cmd Parse, resolve and render compose file in canonical format
# @flag --dry-run Execute command in dry run mode
# @flag --environment Print environment used for interpolation.
# @option --format <string> Format the output.
# @option --hash <string> Print the service config hash, one per line.
# @flag --images Print the image names, one per line.
# @flag --no-consistency Don't check model consistency - warning: may produce invalid Compose output
# @flag --no-interpolate Don't interpolate environment variables
# @flag --no-normalize Don't normalize compose model
# @flag --no-path-resolution Don't resolve file paths
# @option -o --output <file> Save to file (default to stdout)
# @flag --profiles Print the profile names, one per line.
# @flag -q --quiet Only validate the configuration, don't print anything
# @flag --resolve-image-digests Pin image tags to digests
# @flag --services Print the service names, one per line.
# @flag --variables Print model variables and default values.
# @flag --volumes Print the volume names, one per line.
# @arg service*[`_choice_service`]
config() {
:;
}
# }} docker-compose config
# {{ docker-compose cp
# @cmd Copy files/folders between a service container and the local filesystem
# @flag -a --archive Archive mode (copy all uid/gid information)
# @flag --dry-run Execute command in dry run mode
# @flag -L --follow-link Always follow symbol link in SRC_PATH
# @option --index <int> Index of the container if service has multiple replicas
# @arg service-src_path <SERVICE:SRC_PATH>
# @arg dest_path <DEST_PATH|->
cp() {
:;
}
# }} docker-compose cp
# {{ docker-compose create
# @cmd Creates containers for a service
# @flag --build Build images before starting containers
# @flag --dry-run Execute command in dry run mode
# @flag --force-recreate Recreate containers even if their configuration and image haven't changed
# @flag --no-build Don't build an image, even if it's policy
# @flag --no-recreate If containers already exist, don't recreate them.
# @option --pull[always|missing|never|build] <string> Pull image before running (default "policy")
# @flag --quiet-pull Pull without printing progress information
# @flag --remove-orphans Remove containers for services not defined in the Compose file
# @option --scale <scale> Scale SERVICE to NUM instances.
# @arg service*[`_choice_service`]
create() {
:;
}
# }} docker-compose create
# {{ docker-compose down
# @cmd Stop and remove containers, networks
# @flag --dry-run Execute command in dry run mode
# @flag --remove-orphans Remove containers for services not defined in the Compose file
# @option --rmi[local|all] <string> Remove images used by services.
# @option -t --timeout <int> Specify a shutdown timeout in seconds
# @flag -v --volumes Remove named volumes declared in the "volumes" section of the Compose file and anonymous volumes attached to containers
# @arg services*
down() {
:;
}
# }} docker-compose down
# {{ docker-compose events
# @cmd Receive real time events from containers
# @flag --dry-run Execute command in dry run mode
# @flag --json Output events as a stream of json objects
# @arg service*[`_choice_service`]
events() {
:;
}
# }} docker-compose events
# {{ docker-compose exec
# @cmd Execute a command in a running container
# @flag -d --detach Detached mode: Run command in the background
# @flag --dry-run Execute command in dry run mode
# @option -e --env* <string> Set environment variables
# @option --index <int> Index of the container if service has multiple replicas
# @option -T --no-TTY <docker> <compose> <exec> Disable pseudo-TTY allocation.
# @flag --privileged Give extended privileges to the process
# @option -u --user <string> Run the command as this user
# @option -w --workdir <dir> Path to workdir directory for this command
# @arg service[`_choice_service`]
# @arg command[`_module_os_command`]
# @arg args~[`_choice_args`]
exec() {
:;
}
# }} docker-compose exec
# {{ docker-compose images
# @cmd List images used by the created containers
# @flag --dry-run Execute command in dry run mode
# @option --format <string> Format the output.
# @flag -q --quiet Only display IDs
# @arg service*[`_choice_service`]
images() {
:;
}
# }} docker-compose images
# {{ docker-compose kill
# @cmd Force stop service containers
# @flag --dry-run Execute command in dry run mode
# @flag --remove-orphans Remove containers for services not defined in the Compose file
# @option -s --signal <string> SIGNAL to send to the container (default "SIGKILL")
# @arg service*[`_choice_service`]
kill() {
:;
}
# }} docker-compose kill
# {{ docker-compose logs
# @cmd View output from containers
# @flag --dry-run Execute command in dry run mode
# @flag -f --follow Follow log output
# @option --index <int> index of the container if service has multiple replicas
# @flag --no-color Produce monochrome output
# @flag --no-log-prefix Don't print prefix in logs
# @option --since <string> Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
# @option -n --tail <string> Number of lines to show from the end of the logs for each container (default "all")
# @flag -t --timestamps Show timestamps
# @option --until <string> Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
# @arg service*[`_choice_service`]
logs() {
:;
}
# }} docker-compose logs
# {{ docker-compose ls
# @cmd List running compose projects
# @flag -a --all Show all stopped Compose projects
# @flag --dry-run Execute command in dry run mode
# @option --filter <filter> Filter output based on conditions provided
# @option --format <string> Format the output.
# @flag -q --quiet Only display IDs
ls() {
:;
}
# }} docker-compose ls
# {{ docker-compose pause
# @cmd Pause services
# @flag --dry-run Execute command in dry run mode
# @arg service*[`_choice_service`]
pause() {
:;
}
# }} docker-compose pause
# {{ docker-compose port
# @cmd Print the public port for a port binding
# @flag --dry-run Execute command in dry run mode
# @option --index <int> Index of the container if service has multiple replicas
# @option --protocol <string> tcp or udp (default "tcp")
# @arg service[`_choice_service`]
# @arg private_port
port() {
:;
}
# }} docker-compose port
# {{ docker-compose ps
# @cmd List containers
# @flag -a --all Show all stopped containers (including those created by the run command)
# @flag --dry-run Execute command in dry run mode
# @option --filter <string> Filter services by a property (supported filters: status)
# @option --format <string> Format output using a custom template:
# @flag --no-trunc Don't truncate output
# @flag --orphans Include orphaned services (not declared by project) (default true)
# @flag -q --quiet Only display IDs
# @flag --services Display services
# @option --status*[paused|restarting|removing|running|dead|created|exited] <string> Filter services by status.
# @arg service*[`_choice_service`]
ps() {
:;
}
# }} docker-compose ps
# {{ docker-compose pull
# @cmd Pull service images
# @flag --dry-run Execute command in dry run mode
# @flag --ignore-buildable Ignore images that can be built
# @flag --ignore-pull-failures Pull what it can and ignores images with pull failures
# @flag --include-deps Also pull services declared as dependencies
# @option --policy[missing|always] <string> Apply pull policy
# @flag -q --quiet Pull without printing progress information
# @arg service*[`_choice_service`]
pull() {
:;
}
# }} docker-compose pull
# {{ docker-compose push
# @cmd Push service images
# @flag --dry-run Execute command in dry run mode
# @flag --ignore-push-failures Push what it can and ignores images with push failures
# @flag --include-deps Also push images of services declared as dependencies
# @flag -q --quiet Push without printing progress information
# @arg service*[`_choice_service`]
push() {
:;
}
# }} docker-compose push
# {{ docker-compose restart
# @cmd Restart service containers
# @flag --dry-run Execute command in dry run mode
# @flag --no-deps Don't restart dependent services
# @option -t --timeout <int> Specify a shutdown timeout in seconds
# @arg service*[`_choice_service`]
restart() {
:;
}
# }} docker-compose restart
# {{ docker-compose rm
# @cmd Removes stopped service containers
# @flag --dry-run Execute command in dry run mode
# @flag -f --force Don't ask to confirm removal
# @flag -s --stop Stop the containers, if required, before removing
# @flag -v --volumes Remove any anonymous volumes attached to containers
# @arg service*[`_choice_service`]
rm() {
:;
}
# }} docker-compose rm
# {{ docker-compose run
# @cmd Run a one-off command on a service
# @flag --build Build image before starting container
# @option --cap-add <list> Add Linux capabilities
# @option --cap-drop <list> Drop Linux capabilities
# @flag -d --detach Run container in background and print container ID
# @flag --dry-run Execute command in dry run mode
# @option --entrypoint <string> Override the entrypoint of the image
# @option -e --env* <string> Set environment variables
# @flag -i --interactive Keep STDIN open even if not attached (default true)
# @option -l --label* <string> Add or override a label
# @option --name <string> Assign a name to the container
# @flag -T --no-TTY Disable pseudo-TTY allocation (default: auto-detected) (default true)
# @flag --no-deps Don't start linked services
# @option -p --publish* <string> Publish a container's port(s) to the host
# @flag --quiet-pull Pull without printing progress information
# @flag --remove-orphans Remove containers for services not defined in the Compose file
# @flag --rm Automatically remove the container when it exits
# @flag -P --service-ports Run command with all service's ports enabled and mapped to the host
# @flag --use-aliases Use the service's network useAliases in the network(s) the container connects to
# @option -u --user <string> Run as specified username or uid
# @option -v --volume* <string> Bind mount a volume
# @option -w --workdir <dir> Working directory inside the container
# @arg service[`_choice_service`]
# @arg command
# @arg args*
run() {
:;
}
# }} docker-compose run
# {{ docker-compose scale
# @cmd Scale services
# @flag --dry-run Execute command in dry run mode
# @flag --no-deps Don't start linked services
# @arg service-replicas* <SERVICE=REPLICAS>
scale() {
:;
}
# }} docker-compose scale
# {{ docker-compose start
# @cmd Start services
# @flag --dry-run Execute command in dry run mode
# @arg service*[`_choice_service`]
start() {
:;
}
# }} docker-compose start
# {{ docker-compose stats
# @cmd Display a live stream of container(s) resource usage statistics
# @flag -a --all Show all containers (default shows just running)
# @flag --dry-run Execute command in dry run mode
# @option --format <string> Format output using a custom template:
# @flag --no-stream Disable streaming stats and only pull the first result
# @flag --no-trunc Do not truncate output
# @arg service[`_choice_service`]
stats() {
:;
}
# }} docker-compose stats
# {{ docker-compose stop
# @cmd Stop services
# @flag --dry-run Execute command in dry run mode
# @option -t --timeout <int> Specify a shutdown timeout in seconds
# @arg service*[`_choice_service`]
stop() {
:;
}
# }} docker-compose stop
# {{ docker-compose top
# @cmd Display the running processes
# @flag --dry-run Execute command in dry run mode
# @arg services*
top() {
:;
}
# }} docker-compose top
# {{ docker-compose unpause
# @cmd Unpause services
# @flag --dry-run Execute command in dry run mode
# @arg service*[`_choice_service`]
unpause() {
:;
}
# }} docker-compose unpause
# {{ docker-compose up
# @cmd Create and start containers
# @flag --abort-on-container-exit Stops all containers if any container was stopped.
# @flag --abort-on-container-failure Stops all containers if any container exited with failure.
# @flag --always-recreate-deps Recreate dependent containers.
# @option --attach* <string> Restrict attaching to the specified services.
# @flag --attach-dependencies Automatically attach to log output of dependent services
# @flag --build Build images before starting containers
# @flag -d --detach Detached mode: Run containers in the background
# @flag --dry-run Execute command in dry run mode
# @option --exit-code-from <string> Return the exit code of the selected service container.
# @flag --force-recreate Recreate containers even if their configuration and image haven't changed
# @flag --menu Enable interactive shortcuts when running attached.
# @option --no-attach* <string> Do not attach (stream logs) to the specified services
# @flag --no-build Don't build an image, even if it's policy
# @flag --no-color Produce monochrome output
# @flag --no-deps Don't start linked services
# @flag --no-log-prefix Don't print prefix in logs
# @flag --no-recreate If containers already exist, don't recreate them.
# @flag --no-start Don't start the services after creating them
# @option --pull[always|missing|never] <string> Pull image before running (default "policy")
# @flag --quiet-pull Pull without printing progress information
# @flag --remove-orphans Remove containers for services not defined in the Compose file
# @flag -V --renew-anon-volumes Recreate anonymous volumes instead of retrieving data from the previous containers
# @option --scale <scale> Scale SERVICE to NUM instances.
# @option -t --timeout <int> Use this timeout in seconds for container shutdown when attached or when containers are already running
# @flag --timestamps Show timestamps
# @flag --wait Wait for services to be running|healthy.
# @option --wait-timeout <int> Maximum duration to wait for the project to be running|healthy
# @flag -w --watch Watch source code and rebuild/refresh containers when files are updated.
# @arg service*[`_choice_service`]
up() {
:;
}
# }} docker-compose up
# {{ docker-compose version
# @cmd Show the Docker Compose version information
# @flag --dry-run Execute command in dry run mode
# @option -f --format <string> Format the output.
# @flag --short Shows only Compose's version number
version() {
:;
}
# }} docker-compose version
# {{ docker-compose wait
# @cmd Block until the first service container stops
# @flag --down-project Drops project when the first container stops
# @flag --dry-run Execute command in dry run mode
# @arg service*[`_choice_service`]
wait() {
:;
}
# }} docker-compose wait
# {{ docker-compose watch
# @cmd Watch build context for service and rebuild/refresh containers when files are updated
# @flag --dry-run Execute command in dry run mode
# @flag --no-up Do not build & start services before watching
# @flag --prune Prune dangling images on rebuild
# @flag --quiet hide build output
# @arg service*[`_choice_service`]
watch() {
:;
}
# }} docker-compose watch
. "$ARGC_COMPLETIONS_ROOT/utils/_argc_utils.sh"
_choice_service() {
_docker_compose config --services
}
_choice_args() {
_argc_util_comp_subcommand 1
}
_docker_compose() {
docker-compose $(_argc_util_param_select_options --file) "$@"
}
_module_os_command() {
if _argc_util_has_path_prefix; then
_argc_util_comp_path
return
fi
if [[ "$ARGC_OS" == "windows" ]]; then
PATH="$(echo "$PATH" | sed 's|:[^:]*/windows/system32:|:|Ig')" compgen -c
else
compgen -c
fi
}
command eval "$(argc --argc-eval "$0" "$@")"