Debian Codegraph @

ansible_collections/community/docker/plugins/modules/docker_container.py

raw
1 #!/usr/bin/python
2 #
3 # Copyright 2016 Red Hat | Ansible
4 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 from __future__ import annotations
8
9 DOCUMENTATION = r"""
10 module: docker_container
11
12 short_description: manage Docker containers
13
14 description:
15 - Manage the life cycle of Docker containers.
16 - Supports check mode. Run with C(--check) and C(--diff) to view config difference and list of actions to be taken.
17 notes:
18 - For most config changes, the container needs to be recreated. This means that the existing container has to be destroyed
19 and a new one created. This can cause unexpected data loss and downtime. You can use the O(comparisons) option to prevent
20 this.
21 - If the module needs to recreate the container, it will only use the options provided to the module to create the new container
22 (except O(image)). Therefore, always specify B(all) options relevant to the container.
23 - When O(restart) is set to V(true), the module will only restart the container if no config changes are detected.
24 extends_documentation_fragment:
25 - community.docker._docker.api_documentation
26 - community.docker._attributes
27 - community.docker._attributes.actiongroup_docker
28
29 attributes:
30 check_mode:
31 support: partial
32 details:
33 - When trying to pull an image, the module assumes this is never changed in check mode except when the image is not
34 present on the Docker daemon.
35 - This behavior can be configured with O(pull_check_mode_behavior).
36 diff_mode:
37 support: full
38 idempotent:
39 support: partial
40 details:
41 - If O(recreate=true) or O(restart=true) the module is not idempotent.
42
43 options:
44 auto_remove:
45 description:
46 - Enable auto-removal of the container on daemon side when the container's process exits.
47 - If O(container_default_behavior=compatibility), this option has a default of V(false).
48 type: bool
49 blkio_weight:
50 description:
51 - Block IO (relative weight), between 10 and 1000.
52 type: int
53 capabilities:
54 description:
55 - List of capabilities to add to the container.
56 - This is equivalent to C(docker run --cap-add), or the docker-compose option C(cap_add).
57 type: list
58 elements: str
59 cap_drop:
60 description:
61 - List of capabilities to drop from the container.
62 type: list
63 elements: str
64 cgroupns_mode:
65 description:
66 - Specify the cgroup namespace mode for the container.
67 - The Docker CLI calls this simply C(cgroupns).
68 type: str
69 choices:
70 - host
71 - private
72 version_added: 3.0.0
73 cgroup_parent:
74 description:
75 - Specify the parent cgroup for the container.
76 type: str
77 version_added: 1.1.0
78 cleanup:
79 description:
80 - Use with O(detach=false) to remove the container after successful execution.
81 type: bool
82 default: false
83 command:
84 description:
85 - Command to execute when the container starts. A command may be either a string or a list.
86 - Prior to version 2.4, strings were split on commas.
87 - See O(command_handling) for differences in how strings and lists are handled.
88 type: raw
89 comparisons:
90 description:
91 - Allows to specify how properties of existing containers are compared with module options to decide whether the container
92 should be recreated / updated or not.
93 - Only options which correspond to the state of a container as handled by the Docker daemon can be specified, as well
94 as O(networks).
95 - Must be a dictionary specifying for an option one of the keys V(strict), V(ignore) and V(allow_more_present).
96 - If V(strict) is specified, values are tested for equality, and changes always result in updating or restarting. If
97 V(ignore) is specified, changes are ignored.
98 - V(allow_more_present) is allowed only for lists, sets and dicts. If it is specified for lists or sets, the container
99 will only be updated or restarted if the module option contains a value which is not present in the container's options.
100 If the option is specified for a dict, the container will only be updated or restarted if the module option contains
101 a key which is not present in the container's option, or if the value of a key present differs.
102 - The wildcard option C(*) can be used to set one of the default values V(strict) or V(ignore) to I(all) comparisons
103 which are not explicitly set to other values.
104 - See the examples for details.
105 type: dict
106 container_default_behavior:
107 description:
108 - In older versions of this module, various module options used to have default values. This caused problems with containers
109 which use different values for these options.
110 - The default value is now V(no_defaults). To restore the old behavior, set it to V(compatibility), which will ensure
111 that the default values are used when the values are not explicitly specified by the user.
112 - This affects the O(auto_remove), O(detach), O(init), O(interactive), O(memory), O(paused), O(privileged), O(read_only),
113 and O(tty) options.
114 type: str
115 choices:
116 - compatibility
117 - no_defaults
118 default: no_defaults
119 command_handling:
120 description:
121 - The default behavior for O(command) (when provided as a list) and O(entrypoint) is to convert them to strings without
122 considering shell quoting rules. (For comparing idempotency, the resulting string is split considering shell quoting
123 rules).
124 - Also, setting O(command) to an empty list of string, and setting O(entrypoint) to an empty list will be handled as
125 if these options are not specified. This is different from idempotency handling for other container-config related
126 options.
127 - When this is set to V(compatibility), which was the default until community.docker 3.0.0, the current behavior will
128 be kept.
129 - When this is set to V(correct), these options are kept as lists, and an empty value or empty list will be handled
130 correctly for idempotency checks. This has been the default since community.docker 3.0.0.
131 type: str
132 choices:
133 - compatibility
134 - correct
135 version_added: 1.9.0
136 default: correct
137 cpu_period:
138 description:
139 - Limit CPU CFS (Completely Fair Scheduler) period.
140 - See O(cpus) for an easier to use alternative.
141 type: int
142 cpu_quota:
143 description:
144 - Limit CPU CFS (Completely Fair Scheduler) quota.
145 - See O(cpus) for an easier to use alternative.
146 type: int
147 cpus:
148 description:
149 - Specify how much of the available CPU resources a container can use.
150 - A value of V(1.5) means that at most one and a half CPU (core) will be used.
151 type: float
152 cpuset_cpus:
153 description:
154 - CPUs in which to allow execution.
155 - For example V(1,3) or V(1-3).
156 type: str
157 cpuset_mems:
158 description:
159 - Memory nodes (MEMs) in which to allow execution V(0-3) or V(0,1).
160 type: str
161 cpu_shares:
162 description:
163 - CPU shares (relative weight).
164 type: int
165 default_host_ip:
166 description:
167 - Define the default host IP to use.
168 - Must be an empty string, an IPv4 address, or an IPv6 address.
169 - With Docker 20.10.2 or newer, this should be set to an empty string (V("")) to avoid the port bindings without an
170 explicit IP address to only bind to IPv4. See U(https://github.com/ansible-collections/community.docker/issues/70)
171 for details.
172 - By default, the module will try to auto-detect this value from the C(bridge) network's C(com.docker.network.bridge.host_binding_ipv4)
173 option. If it cannot auto-detect it, it will fall back to V(0.0.0.0).
174 type: str
175 version_added: 1.2.0
176 detach:
177 description:
178 - Enable detached mode to leave the container running in background.
179 - If disabled, the task will reflect the status of the container run (failed if the command failed).
180 - If O(container_default_behavior=compatibility), this option has a default of V(true).
181 type: bool
182 devices:
183 description:
184 - List of host device bindings to add to the container.
185 - Each binding is a mapping expressed in the format C(<path_on_host>:<path_in_container>:<cgroup_permissions>).
186 type: list
187 elements: str
188 device_read_bps:
189 description:
190 - List of device path and read rate (bytes per second) from device.
191 type: list
192 elements: dict
193 suboptions:
194 path:
195 description:
196 - Device path in the container.
197 type: str
198 required: true
199 rate:
200 description:
201 - Device read limit in format C(<number>[<unit>]).
202 - Number is a positive integer. Unit can be one of V(B) (byte), V(K) (kibibyte, 1024B), V(M) (mebibyte), V(G) (gibibyte),
203 V(T) (tebibyte), or V(P) (pebibyte).
204 - Omitting the unit defaults to bytes.
205 type: str
206 required: true
207 device_write_bps:
208 description:
209 - List of device and write rate (bytes per second) to device.
210 type: list
211 elements: dict
212 suboptions:
213 path:
214 description:
215 - Device path in the container.
216 type: str
217 required: true
218 rate:
219 description:
220 - Device read limit in format C(<number>[<unit>]).
221 - Number is a positive integer. Unit can be one of V(B) (byte), V(K) (kibibyte, 1024B), V(M) (mebibyte), V(G) (gibibyte),
222 V(T) (tebibyte), or V(P) (pebibyte).
223 - Omitting the unit defaults to bytes.
224 type: str
225 required: true
226 device_read_iops:
227 description:
228 - List of device and read rate (IO per second) from device.
229 type: list
230 elements: dict
231 suboptions:
232 path:
233 description:
234 - Device path in the container.
235 type: str
236 required: true
237 rate:
238 description:
239 - Device read limit.
240 - Must be a positive integer.
241 type: int
242 required: true
243 device_write_iops:
244 description:
245 - List of device and write rate (IO per second) to device.
246 type: list
247 elements: dict
248 suboptions:
249 path:
250 description:
251 - Device path in the container.
252 type: str
253 required: true
254 rate:
255 description:
256 - Device read limit.
257 - Must be a positive integer.
258 type: int
259 required: true
260 device_requests:
261 description:
262 - Allows to request additional resources, such as GPUs.
263 type: list
264 elements: dict
265 suboptions:
266 capabilities:
267 description:
268 - List of lists of strings to request capabilities.
269 - The top-level list entries are combined by OR, and for every list entry, the entries in the list it contains are
270 combined by AND.
271 - The driver tries to satisfy one of the sub-lists.
272 - Available capabilities for the C(nvidia) driver can be found at U(https://github.com/NVIDIA/nvidia-container-runtime).
273 type: list
274 elements: list
275 count:
276 description:
277 - Number or devices to request.
278 - Set to V(-1) to request all available devices.
279 type: int
280 device_ids:
281 description:
282 - List of device IDs.
283 type: list
284 elements: str
285 driver:
286 description:
287 - Which driver to use for this device.
288 type: str
289 options:
290 description:
291 - Driver-specific options.
292 type: dict
293 version_added: 0.1.0
294 device_cgroup_rules:
295 description:
296 - List of cgroup rules to apply to the container.
297 type: list
298 elements: str
299 version_added: 3.11.0
300 dns_opts:
301 description:
302 - List of DNS options.
303 type: list
304 elements: str
305 dns_servers:
306 description:
307 - List of custom DNS servers.
308 type: list
309 elements: str
310 dns_search_domains:
311 description:
312 - List of custom DNS search domains.
313 type: list
314 elements: str
315 domainname:
316 description:
317 - Container domainname.
318 type: str
319 env:
320 description:
321 - Dictionary of key,value pairs.
322 - Values which might be parsed as numbers, booleans or other types by the YAML parser must be quoted (for example V("true"))
323 in order to avoid data loss.
324 - Please note that if you are passing values in with Jinja2 templates, like V("{{ value }}"), you need to add V(| string)
325 to prevent Ansible to convert strings such as V("true") back to booleans. The correct way is to use V("{{ value |
326 string }}").
327 type: dict
328 env_file:
329 description:
330 - Path to a file, present on the target, containing environment variables C(FOO=BAR).
331 - If variable also present in O(env), then the O(env) value will override.
332 type: path
333 entrypoint:
334 description:
335 - Command that overwrites the default C(ENTRYPOINT) of the image.
336 - See O(command_handling) for differences in how strings and lists are handled.
337 type: list
338 elements: str
339 etc_hosts:
340 description:
341 - Dict of host-to-IP mappings, where each host name is a key in the dictionary. Each host name will be added to the
342 container's C(/etc/hosts) file.
343 - Instead of an IP address, the special value V(host-gateway) can also be used, which resolves to the host's gateway
344 IP and allows containers to connect to services running on the host.
345 type: dict
346 exposed_ports:
347 description:
348 - List of additional container ports which informs Docker that the container listens on the specified network ports
349 at runtime.
350 - If the port is already exposed using C(EXPOSE) in a Dockerfile, it does not need to be exposed again.
351 type: list
352 elements: str
353 aliases:
354 - exposed
355 - expose
356 force_kill:
357 description:
358 - Use the kill command when stopping a running container.
359 type: bool
360 default: false
361 aliases:
362 - forcekill
363 groups:
364 description:
365 - List of additional group names and/or IDs that the container process will run as.
366 type: list
367 elements: str
368 healthcheck:
369 description:
370 - Configure a check that is run to determine whether or not containers for this service are "healthy".
371 - See the docs for the L(HEALTHCHECK Dockerfile instruction,https://docs.docker.com/engine/reference/builder/#healthcheck)
372 for details on how healthchecks work.
373 - 'O(healthcheck.interval), O(healthcheck.timeout), O(healthcheck.start_period), and O(healthcheck.start_interval) are
374 specified as durations. They accept duration as a string in a format that look like: V(5h34m56s), V(1m30s), and so
375 on. The supported units are V(us), V(ms), V(s), V(m) and V(h).'
376 - See also O(state=healthy).
377 type: dict
378 suboptions:
379 test:
380 description:
381 - Command to run to check health.
382 - Must be either a string or a list. If it is a list, the first item must be one of V(NONE), V(CMD) or V(CMD-SHELL).
383 type: raw
384 test_cli_compatible:
385 description:
386 - If set to V(true), omitting O(healthcheck.test) while providing O(healthcheck) does not disable healthchecks,
387 but simply overwrites the image's values by the ones specified in O(healthcheck). This is the behavior used by
388 the Docker CLI.
389 - If set to V(false), omitting O(healthcheck.test) will disable the container's health check. This is the classical
390 behavior of the module and currently the default behavior.
391 default: false
392 type: bool
393 version_added: 3.10.0
394 interval:
395 description:
396 - Time between running the check.
397 - The default used by the Docker daemon is V(30s).
398 type: str
399 timeout:
400 description:
401 - Maximum time to allow one check to run.
402 - The default used by the Docker daemon is V(30s).
403 type: str
404 retries:
405 description:
406 - Consecutive number of failures needed to report unhealthy.
407 - The default used by the Docker daemon is V(3).
408 type: int
409 start_period:
410 description:
411 - Start period for the container to initialize before starting health-retries countdown.
412 - The default used by the Docker daemon is V(0s).
413 type: str
414 start_interval:
415 description:
416 - Time between health checks during the start period. This option requires Docker Engine version 25.0 or later.
417 - The default used by the Docker daemon is V(5s).
418 type: str
419 version_added: 3.10.0
420 hostname:
421 description:
422 - The container's hostname.
423 type: str
424 image:
425 description:
426 - Repository path and tag used to create the container. If an image is not found or pull is true, the image will be
427 pulled from the registry. If no tag is included, V(latest) will be used.
428 - Can also be an image ID. If this is the case, the image is assumed to be available locally. The O(pull) option is
429 ignored for this case.
430 type: str
431 image_comparison:
432 description:
433 - Determines which image to use for idempotency checks that depend on image parameters.
434 - The default, V(desired-image), will use the image that is provided to the module with the O(image) parameter.
435 - V(current-image) will use the image that the container is currently using, if the container exists. It falls back
436 to the image that is provided in case the container does not yet exist.
437 - This affects the O(env), O(env_file), O(exposed_ports), O(labels), and O(volumes) options.
438 type: str
439 choices:
440 - desired-image
441 - current-image
442 default: desired-image
443 version_added: 3.0.0
444 image_label_mismatch:
445 description:
446 - How to handle labels inherited from the image that are not set explicitly.
447 - When V(ignore), labels that are present in the image but not specified in O(labels) will be ignored. This is useful
448 to avoid having to specify the image labels in O(labels) while keeping labels O(comparisons) V(strict).
449 - When V(fail), if there are labels present in the image which are not set from O(labels), the module will fail. This
450 prevents introducing unexpected labels from the base image.
451 - 'B(Warning:) This option is ignored unless C(labels: strict) or C(*: strict) is specified in the O(comparisons) option.'
452 type: str
453 choices:
454 - 'ignore'
455 - 'fail'
456 default: ignore
457 version_added: 2.6.0
458 image_name_mismatch:
459 description:
460 - Determines what the module does if the image matches, but the image name in the container's configuration does not
461 match the image name provided to the module.
462 - 'This is ignored if C(image: ignore) is set in O(comparisons).'
463 - If set to V(recreate) (default) the container will be recreated.
464 - If set to V(ignore) the container will not be recreated because of this. It might still get recreated for other reasons.
465 This has been the default behavior of the module for a long time, but might not be what users expect.
466 - The default changed from V(ignore) to V(recreate) in community.docker 4.0.0.
467 type: str
468 choices:
469 - recreate
470 - ignore
471 default: recreate
472 version_added: 3.2.0
473 init:
474 description:
475 - Run an init inside the container that forwards signals and reaps processes.
476 - If O(container_default_behavior=compatibility), this option has a default of V(false).
477 type: bool
478 interactive:
479 description:
480 - Keep stdin open after a container is launched, even if not attached.
481 - If O(container_default_behavior=compatibility), this option has a default of V(false).
482 type: bool
483 ipc_mode:
484 description:
485 - Set the IPC mode for the container.
486 - Can be one of V(container:<name|id>) to reuse another container's IPC namespace or V(host) to use the host's IPC namespace
487 within the container.
488 type: str
489 keep_volumes:
490 description:
491 - Retain anonymous volumes associated with a removed container.
492 type: bool
493 default: true
494 kill_signal:
495 description:
496 - Override default signal used to kill a running container.
497 type: str
498 kernel_memory:
499 description:
500 - Kernel memory limit in format C(<number>[<unit>]). Number is a positive integer. Unit can be V(B) (byte), V(K) (kibibyte,
501 1024B), V(M) (mebibyte), V(G) (gibibyte), V(T) (tebibyte), or V(P) (pebibyte). Minimum is V(4M).
502 - Omitting the unit defaults to bytes.
503 type: str
504 labels:
505 description:
506 - Dictionary of key value pairs.
507 type: dict
508 links:
509 description:
510 - List of name aliases for linked containers in the format C(container_name:alias).
511 - Setting this will force container to be restarted.
512 type: list
513 elements: str
514 log_driver:
515 description:
516 - Specify the logging driver. Docker uses V(json-file) by default.
517 - See L(the Docker logging configuration documentation,https://docs.docker.com/config/containers/logging/configure/)
518 for possible choices.
519 type: str
520 log_options:
521 description:
522 - Dictionary of options specific to the chosen O(log_driver).
523 - See U(https://docs.docker.com/engine/admin/logging/overview/) for details.
524 - O(log_driver) needs to be specified for O(log_options) to take effect, even if using the default V(json-file) driver.
525 type: dict
526 aliases:
527 - log_opt
528 mac_address:
529 description:
530 - Container MAC address (for example, V(92:d0:c6:0a:29:33)).
531 - Note that the global container-wide MAC address is deprecated and no longer used since Docker API version 1.44.
532 - Use O(networks[].mac_address) instead.
533 type: str
534 memory:
535 description:
536 - Memory limit in format C(<number>[<unit>]). Number is a positive integer. Unit can be V(B) (byte), V(K) (kibibyte,
537 1024B), V(M) (mebibyte), V(G) (gibibyte), V(T) (tebibyte), or V(P) (pebibyte).
538 - Omitting the unit defaults to bytes.
539 - If O(container_default_behavior=compatibility), this option has a default of V("0").
540 type: str
541 memory_reservation:
542 description:
543 - Memory soft limit in format C(<number>[<unit>]). Number is a positive integer. Unit can be V(B) (byte), V(K) (kibibyte,
544 1024B), V(M) (mebibyte), V(G) (gibibyte), V(T) (tebibyte), or V(P) (pebibyte).
545 - Omitting the unit defaults to bytes.
546 type: str
547 memory_swap:
548 description:
549 - Total memory limit (memory + swap) in format C(<number>[<unit>]), or the special values V(unlimited) or V(-1) for
550 unlimited swap usage. Number is a positive integer. Unit can be V(B) (byte), V(K) (kibibyte, 1024B), V(M) (mebibyte),
551 V(G) (gibibyte), V(T) (tebibyte), or V(P) (pebibyte).
552 - Omitting the unit defaults to bytes.
553 type: str
554 memory_swappiness:
555 description:
556 - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
557 - If not set, the value will be remain the same if container exists and will be inherited from the host machine if it
558 is (re-)created.
559 type: int
560 mounts:
561 type: list
562 elements: dict
563 description:
564 - Specification for mounts to be added to the container. More powerful alternative to O(volumes).
565 suboptions:
566 target:
567 description:
568 - Path inside the container.
569 type: str
570 required: true
571 source:
572 description:
573 - Mount source.
574 - For example, this can be a volume name or a host path.
575 - If not supplied when O(mounts[].type=volume) an anonymous volume will be created.
576 type: str
577 type:
578 description:
579 - The mount type.
580 - Note that V(npipe) is only supported by Docker for Windows.
581 - V(cluster) requires Docker API 1.42+ and has been added in community.docker 4.8.0.
582 - V(image) requires Docker API 1.47+ and has been added in community.docker 4.8.0.
583 type: str
584 choices:
585 - bind
586 - npipe
587 - tmpfs
588 - volume
589 - cluster
590 - image
591 default: volume
592 read_only:
593 description:
594 - Whether the mount should be read-only.
595 type: bool
596 consistency:
597 description:
598 - The consistency requirement for the mount.
599 type: str
600 choices:
601 - cached
602 - consistent
603 - default
604 - delegated
605 create_mountpoint:
606 description:
607 - Create mount point on host if missing.
608 - Requires Docker API 1.42+.
609 - Only valid for O(mounts[].type=bind).
610 type: bool
611 version_added: 4.8.0
612 propagation:
613 description:
614 - Propagation mode. Only valid for the V(bind) type.
615 type: str
616 choices:
617 - private
618 - rprivate
619 - shared
620 - rshared
621 - slave
622 - rslave
623 no_copy:
624 description:
625 - False if the volume should be populated with the data from the target. Only valid for the V(volume) type.
626 - The default value is V(false).
627 type: bool
628 non_recursive:
629 description:
630 - Disable recursive bind mount.
631 - Requires Docker API 1.40+.
632 - Only valid for O(mounts[].type=bind).
633 type: bool
634 version_added: 4.8.0
635 read_only_non_recursive:
636 description:
637 - Make the mount non-recursively read-only, but still leave the mount recursive (unless NonRecursive is set to true in conjunction).
638 - Requires Docker API 1.44+.
639 - Only valid for O(mounts[].type=bind).
640 type: bool
641 version_added: 4.8.0
642 read_only_force_recursive:
643 description:
644 - Raise an error if the mount cannot be made recursively read-only.
645 - Requires Docker API 1.44+.
646 - Only valid for O(mounts[].type=bind).
647 type: bool
648 version_added: 4.8.0
649 labels:
650 description:
651 - User-defined name and labels for the volume. Only valid for the V(volume) type.
652 type: dict
653 volume_driver:
654 description:
655 - Specify the volume driver. Only valid for the V(volume) type.
656 - See L(here,https://docs.docker.com/storage/volumes/#use-a-volume-driver) for details.
657 type: str
658 volume_options:
659 description:
660 - Dictionary of options specific to the chosen volume_driver. See L(here,https://docs.docker.com/storage/volumes/#use-a-volume-driver)
661 for details.
662 type: dict
663 subpath:
664 type: str
665 description:
666 - Source path inside the volume/image. Must be relative without any back traversals.
667 - Requires Docker API 1.45+.
668 - Only valid for O(mounts[].type=volume) or O(mounts[].type=image).
669 version_added: 4.8.0
670 tmpfs_size:
671 description:
672 - The size for the tmpfs mount in bytes in format <number>[<unit>].
673 - Number is a positive integer. Unit can be one of V(B) (byte), V(K) (kibibyte, 1024B), V(M) (mebibyte), V(G) (gibibyte),
674 V(T) (tebibyte), or V(P) (pebibyte).
675 - Omitting the unit defaults to bytes.
676 type: str
677 tmpfs_mode:
678 description:
679 - The permission mode for the tmpfs mount.
680 type: str
681 tmpfs_options:
682 type: list
683 elements: dict
684 description:
685 - Options to be passed to the tmpfs mount.
686 - Every list element must be a dictionary with one key and a value.
687 All keys must be strings, and values can be either a string or V(null)/V(none) for a flag.
688 - Requires Docker API 1.46+.
689 - Only valid for O(mounts[].type=tmpfs).
690 version_added: 4.8.0
691 name:
692 description:
693 - Assign a name to a new container or match an existing container.
694 - When identifying an existing container name may be a name or a long or short container ID.
695 type: str
696 required: true
697 network_mode:
698 description:
699 - Connect the container to a network. Choices are V(bridge), V(host), V(none), C(container:<name|id>), C(<network_name>)
700 or V(default).
701 - Since community.docker 2.0.0, if O(networks_cli_compatible=true) and O(networks) contains at least one network, the
702 default value for O(network_mode) is the name of the first network in the O(networks) list. You can prevent this by
703 explicitly specifying a value for O(network_mode), like the default value V(default) which will be used by Docker
704 if O(network_mode) is not specified.
705 type: str
706 userns_mode:
707 description:
708 - Set the user namespace mode for the container. Currently, the only valid value are V(host) and the empty string (V("")).
709 type: str
710 networks:
711 description:
712 - List of networks the container belongs to.
713 - For examples of the data structure and usage see EXAMPLES below.
714 - 'To remove a container from one or more networks, use C(networks: strict) in the O(comparisons) option.'
715 - 'If O(networks_cli_compatible=false), this will not remove the default network if O(networks) is specified. This is
716 different from the behavior of C(docker run ...). You need to explicitly use C(networks: strict) in O(comparisons)
717 to enforce the removal of the default network (and all other networks not explicitly mentioned in O(networks)) in
718 that case.'
719 type: list
720 elements: dict
721 suboptions:
722 name:
723 description:
724 - The network's name.
725 type: str
726 required: true
727 ipv4_address:
728 description:
729 - The container's IPv4 address in this network.
730 type: str
731 ipv6_address:
732 description:
733 - The container's IPv6 address in this network.
734 type: str
735 links:
736 description:
737 - A list of containers to link to.
738 type: list
739 elements: str
740 aliases:
741 description:
742 - List of aliases for this container in this network. These names can be used in the network to reach this container.
743 type: list
744 elements: str
745 mac_address:
746 description:
747 - Endpoint MAC address (for example, V(92:d0:c6:0a:29:33)).
748 - This is only available for Docker API version 1.44 and later.
749 - Please note that when a container is attached to a network after creation, this is currently ignored by the Docker
750 Daemon at least in some cases. When passed on creation, this seems to work better.
751 type: str
752 version_added: 3.6.0
753 driver_opts:
754 description:
755 - Dictionary of driver options for this network endpoint.
756 - Allows setting endpoint-specific driver options like C(com.docker.network.endpoint.ifname) to set a custom network interface name.
757 - Requires Docker API version 1.32 or newer.
758 type: dict
759 version_added: 5.0.0
760 gw_priority:
761 description:
762 - Gateway priority for this network endpoint.
763 - When a container is connected to multiple networks, this controls which network's gateway is used as the default gateway.
764 - Higher values indicate higher priority.
765 - Requires Docker API version 1.48 or newer.
766 type: int
767 version_added: 5.0.0
768 networks_cli_compatible:
769 description:
770 - If O(networks_cli_compatible=true) (default), this module will behave as C(docker run --network) and will B(not) add
771 the default network if O(networks) is specified. If O(networks) is not specified, the default network will be attached.
772 - 'When O(networks_cli_compatible=false) and networks are provided to the module with the O(networks) option, the module
773 behaves differently than C(docker run --network): C(docker run --network other) will create a container with network
774 C(other) attached, but the default network not attached. This module with O(networks) set to C({name: other}) will
775 create a container with both C(default) and C(other) attached. If C(networks: strict) or C(*: strict) is set in O(comparisons),
776 the C(default) network will be removed afterwards.'
777 type: bool
778 default: true
779 oom_killer:
780 description:
781 - Whether or not to disable OOM Killer for the container.
782 type: bool
783 oom_score_adj:
784 description:
785 - An integer value containing the score given to the container in order to tune OOM killer preferences.
786 type: int
787 output_logs:
788 description:
789 - If set to true, output of the container command will be printed.
790 - Only effective when O(log_driver) is set to V(json-file), V(journald), or V(local).
791 type: bool
792 default: false
793 paused:
794 description:
795 - Use with the started state to pause running processes inside the container.
796 - If O(container_default_behavior=compatibility), this option has a default of V(false).
797 type: bool
798 pid_mode:
799 description:
800 - Set the PID namespace mode for the container.
801 type: str
802 pids_limit:
803 description:
804 - Set PIDs limit for the container. It accepts an integer value.
805 - Set V(-1) for unlimited PIDs.
806 type: int
807 platform:
808 description:
809 - Platform for the container in the format C(os[/arch[/variant]]).
810 - "Note that since community.docker 3.5.0, the module uses both the image's metadata and the Docker daemon's information
811 to normalize platform strings similarly to how Docker itself is doing this. If you notice idempotency problems, please
812 verify whether this is still a problem with the latest release of community.docker, and if it is,
813 L(create an issue in the community.docker GitHub repository,
814 https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md).
815 For older community.docker versions, you can use the O(comparisons) option with C(platform: ignore) to prevent accidental
816 recreation of the container due to this."
817 type: str
818 version_added: 3.0.0
819 privileged:
820 description:
821 - Give extended privileges to the container.
822 - If O(container_default_behavior=compatibility), this option has a default of V(false).
823 type: bool
824 publish_all_ports:
825 description:
826 - Publish all ports to the host.
827 - Any specified port bindings from O(published_ports) will remain intact when V(true).
828 type: bool
829 version_added: 1.8.0
830 published_ports:
831 description:
832 - List of ports to publish from the container to the host.
833 - 'Use docker CLI syntax: V(8000), V(9000:8000), or V(0.0.0.0:9000:8000), where 8000 is a container port, 9000 is a
834 host port, and 0.0.0.0 is a host interface.'
835 - Port ranges can be used for source and destination ports. If two ranges with different lengths are specified, the
836 shorter range will be used. Since community.general 0.2.0, if the source port range has length 1, the port will not
837 be assigned to the first port of the destination range, but to a free port in that range. This is the same behavior
838 as for C(docker) command line utility.
839 - Bind addresses must be either IPv4 or IPv6 addresses. Hostnames are B(not) allowed. This is different from the C(docker)
840 command line utility. Use the P(community.general.dig#lookup) lookup to resolve hostnames.
841 - If O(networks) parameter is provided, will inspect each network to see if there exists a bridge network with optional
842 parameter C(com.docker.network.bridge.host_binding_ipv4). If such a network is found, then published ports where no
843 host IP address is specified will be bound to the host IP pointed to by C(com.docker.network.bridge.host_binding_ipv4).
844 Note that the first bridge network with a C(com.docker.network.bridge.host_binding_ipv4) value encountered in the
845 list of O(networks) is the one that will be used.
846 - The value V(all) was allowed in earlier versions of this module. Support for it was removed in community.docker 3.0.0.
847 Use the O(publish_all_ports) option instead.
848 type: list
849 elements: str
850 aliases:
851 - ports
852 pull:
853 description:
854 - If set to V(never), will never try to pull an image. Will fail if the image is not available on the Docker daemon.
855 - If set to V(missing) or V(false), only pull the image if it is not available on the Docker daemon. This is the default
856 behavior.
857 - If set to V(always) or V(true), always try to pull the latest version of the image.
858 - B(Note:) images are only pulled when specified by name. If the image is specified as a image ID (hash), it cannot
859 be pulled, and this option is ignored.
860 - B(Note:) the values V(never), V(missing), and V(always) are only available since community.docker 3.8.0. Earlier versions
861 only support V(true) and V(false).
862 type: raw
863 choices:
864 - never
865 - missing
866 - always
867 - true
868 - false
869 default: missing
870 pull_check_mode_behavior:
871 description:
872 - Allows to adjust the behavior when O(pull=always) or O(pull=true) in check mode.
873 - Since the Docker daemon does not expose any functionality to test whether a pull will result in a changed image, the
874 module by default acts like O(pull=always) only results in a change when the image is not present.
875 - If set to V(image_not_present) (default), only report changes in check mode when the image is not present.
876 - If set to V(always), always report changes in check mode.
877 type: str
878 default: image_not_present
879 choices:
880 - image_not_present
881 - always
882 version_added: 3.8.0
883 read_only:
884 description:
885 - Mount the container's root file system as read-only.
886 - If O(container_default_behavior=compatibility), this option has a default of V(false).
887 type: bool
888 recreate:
889 description:
890 - Use with present and started states to force the re-creation of an existing container.
891 type: bool
892 default: false
893 removal_wait_timeout:
894 description:
895 - When removing an existing container, the docker daemon API call exists after the container is scheduled for removal.
896 Removal usually is very fast, but it can happen that during high I/O load, removal can take longer. By default, the
897 module will wait until the container has been removed before trying to (re-)create it, however long this takes.
898 - By setting this option, the module will wait at most this many seconds for the container to be removed. If the container
899 is still in the removal phase after this many seconds, the module will fail.
900 type: float
901 restart:
902 description:
903 - Use with started state to force a matching container to be stopped and restarted.
904 type: bool
905 default: false
906 restart_policy:
907 description:
908 - Container restart policy.
909 - Place quotes around V(no) option.
910 type: str
911 choices:
912 - 'no'
913 - 'on-failure'
914 - 'always'
915 - 'unless-stopped'
916 restart_retries:
917 description:
918 - Use with restart policy to control maximum number of restart attempts.
919 type: int
920 runtime:
921 description:
922 - Runtime to use for the container.
923 type: str
924 shm_size:
925 description:
926 - Size of C(/dev/shm) in format C(<number>[<unit>]). Number is positive integer. Unit can be V(B) (byte), V(K) (kibibyte,
927 1024B), V(M) (mebibyte), V(G) (gibibyte), V(T) (tebibyte), or V(P) (pebibyte).
928 - Omitting the unit defaults to bytes. If you omit the size entirely, Docker daemon uses V(64M).
929 type: str
930 security_opts:
931 description:
932 - List of security options in the form of C("label:user:User").
933 type: list
934 elements: str
935 state:
936 description:
937 - V(absent) - A container matching the specified name will be stopped and removed. Use O(force_kill) to kill the container
938 rather than stopping it. Use O(keep_volumes) to retain anonymous volumes associated with the removed container.
939 - V(present) - Asserts the existence of a container matching the name and any provided configuration parameters. If
940 no container matches the name, a container will be created. If a container matches the name but the provided configuration
941 does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and re-created
942 with the requested config.
943 - V(started) - Asserts that the container is first V(present), and then if the container is not running moves it to
944 a running state. Use O(restart) to force a matching container to be stopped and restarted.
945 - V(healthy) - Asserts that the container is V(present) and V(started), and is actually healthy as well. This means
946 that the conditions defined in O(healthcheck) respectively in the image's C(HEALTHCHECK) (L(Docker reference for HEALTHCHECK,
947 https://docs.docker.com/reference/dockerfile/#healthcheck)) are satisfied. The time waited can be controlled with
948 O(healthy_wait_timeout). This state has been added in community.docker 3.11.0.
949 - V(stopped) - Asserts that the container is first V(present), and then if the container is running moves it to a stopped
950 state.
951 - 'To control what will be taken into account when comparing configuration, see the O(comparisons) option. To avoid
952 that the image version will be taken into account, you can also use the V(image: ignore) in the O(comparisons) option.'
953 - Use the O(recreate) option to always force re-creation of a matching container, even if it is running.
954 - If the container should be killed instead of stopped in case it needs to be stopped for recreation, or because O(state)
955 is V(stopped), please use the O(force_kill) option. Use O(keep_volumes) to retain anonymous volumes associated with
956 a removed container.
957 - Use O(keep_volumes) to retain anonymous volumes associated with a removed container.
958 type: str
959 default: started
960 choices:
961 - absent
962 - present
963 - healthy
964 - stopped
965 - started
966 stop_signal:
967 description:
968 - Override default signal used to stop the container.
969 type: str
970 healthy_wait_timeout:
971 description:
972 - When waiting for the container to become healthy if O(state=healthy), this option controls how long the module waits
973 until the container state becomes healthy.
974 - The timeout is specified in seconds. The default, V(300), is 5 minutes.
975 - Set this to 0 or a negative value to wait indefinitely. Note that depending on the container this can result in the
976 module not terminating.
977 default: 300
978 type: float
979 version_added: 3.11.0
980 stop_timeout:
981 description:
982 - Number of seconds to wait for the container to stop before sending C(SIGKILL). When the container is created by this
983 module, its C(StopTimeout) configuration will be set to this value.
984 - When the container is stopped, will be used as a timeout for stopping the container. In case the container has a custom
985 C(StopTimeout) configuration, the behavior depends on the version of the docker daemon. New versions of the docker
986 daemon will always use the container's configured C(StopTimeout) value if it has been configured.
987 type: int
988 storage_opts:
989 description:
990 - Storage driver options for this container as a key-value mapping.
991 type: dict
992 version_added: 1.3.0
993 tmpfs:
994 description:
995 - Mount a tmpfs directory.
996 type: list
997 elements: str
998 tty:
999 description:
1000 - Allocate a pseudo-TTY.
1001 - If O(container_default_behavior=compatibility), this option has a default of V(false).
1002 type: bool
1003 ulimits:
1004 description:
1005 - List of ulimit options. A ulimit is specified as V(nofile:262144:262144).
1006 type: list
1007 elements: str
1008 sysctls:
1009 description:
1010 - Dictionary of key,value pairs.
1011 type: dict
1012 user:
1013 description:
1014 - Sets the username or UID used and optionally the groupname or GID for the specified command.
1015 - Can be of the forms C(user), C(user:group), C(uid), C(uid:gid), C(user:gid) or C(uid:group).
1016 type: str
1017 uts:
1018 description:
1019 - Set the UTS namespace mode for the container.
1020 type: str
1021 volumes:
1022 description:
1023 - List of volumes to mount within the container.
1024 - 'Use docker CLI-style syntax: C(/host:/container[:mode]).'
1025 - Mount modes can be a comma-separated list of various modes such as V(ro), V(rw), V(consistent), V(delegated), V(cached),
1026 V(rprivate), V(private), V(rshared), V(shared), V(rslave), V(slave), and V(nocopy). Note that the docker daemon might
1027 not support all modes and combinations of such modes.
1028 - SELinux hosts can additionally use V(z) or V(Z) to use a shared or private label for the volume.
1029 - Note that Ansible 2.7 and earlier only supported one mode, which had to be one of V(ro), V(rw), V(z), and V(Z).
1030 type: list
1031 elements: str
1032 volume_driver:
1033 description:
1034 - The container volume driver.
1035 type: str
1036 volumes_from:
1037 description:
1038 - List of container names or IDs to get volumes from.
1039 type: list
1040 elements: str
1041 working_dir:
1042 description:
1043 - Path to the working directory.
1044 type: str
1045
1046 author:
1047 - "Cove Schneider (@cove)"
1048 - "Joshua Conner (@joshuaconner)"
1049 - "Pavel Antonov (@softzilla)"
1050 - "Thomas Steinbach (@ThomasSteinbach)"
1051 - "Philippe Jandot (@zfil)"
1052 - "Daan Oosterveld (@dusdanig)"
1053 - "Chris Houseknecht (@chouseknecht)"
1054 - "Kassian Sun (@kassiansun)"
1055 - "Felix Fontein (@felixfontein)"
1056
1057 requirements:
1058 - "Docker API >= 1.25"
1059 """
1060
1061 EXAMPLES = r"""
1062 ---
1063 - name: Create a data container
1064 community.docker.docker_container:
1065 name: mydata
1066 image: busybox
1067 volumes:
1068 - /data
1069
1070 - name: Re-create a redis container
1071 community.docker.docker_container:
1072 name: myredis
1073 image: redis
1074 command: redis-server --appendonly yes
1075 state: present
1076 recreate: true
1077 exposed_ports:
1078 - 6379
1079 volumes_from:
1080 - mydata
1081
1082 - name: Restart a container
1083 community.docker.docker_container:
1084 name: myapplication
1085 image: someuser/appimage
1086 state: started
1087 restart: true
1088 links:
1089 - "myredis:aliasedredis"
1090 devices:
1091 - "/dev/sda:/dev/xvda:rwm"
1092 ports:
1093 # Publish container port 9000 as host port 8080
1094 - "8080:9000"
1095 # Publish container UDP port 9001 as host port 8081 on interface 127.0.0.1
1096 - "127.0.0.1:8081:9001/udp"
1097 # Publish container port 9002 as a random host port
1098 - "9002"
1099 # Publish container port 9003 as a free host port in range 8000-8100
1100 # (the host port will be selected by the Docker daemon)
1101 - "8000-8100:9003"
1102 # Publish container ports 9010-9020 to host ports 7000-7010
1103 - "7000-7010:9010-9020"
1104 env:
1105 SECRET_KEY: "ssssh"
1106 # Values which might be parsed as numbers, booleans or other types by the YAML parser need to be quoted
1107 BOOLEAN_KEY: "yes"
1108
1109 - name: Container present
1110 community.docker.docker_container:
1111 name: mycontainer
1112 state: present
1113 image: ubuntu:14.04
1114 command: sleep infinity
1115
1116 - name: Stop a container
1117 community.docker.docker_container:
1118 name: mycontainer
1119 state: stopped
1120
1121 - name: Start 4 load-balanced containers
1122 community.docker.docker_container:
1123 name: "container{{ item }}"
1124 recreate: true
1125 image: someuser/anotherappimage
1126 command: sleep 1d
1127 with_sequence: count=4
1128
1129 - name: Remove container
1130 community.docker.docker_container:
1131 name: ohno
1132 state: absent
1133
1134 - name: Syslogging output
1135 community.docker.docker_container:
1136 name: myservice
1137 image: busybox
1138 log_driver: syslog
1139 log_options:
1140 syslog-address: tcp://my-syslog-server:514
1141 syslog-facility: daemon
1142 # NOTE: in Docker 1.13+ the "syslog-tag" option was renamed to "tag" for
1143 # older docker installs, use "syslog-tag" instead
1144 tag: myservice
1145
1146 - name: Create db container and connect to network
1147 community.docker.docker_container:
1148 name: db_test
1149 image: "postgres:latest"
1150 networks:
1151 - name: "{{ docker_network_name }}"
1152
1153 - name: Start container, connect to network and link
1154 community.docker.docker_container:
1155 name: sleeper
1156 image: ubuntu:14.04
1157 networks:
1158 - name: TestingNet
1159 ipv4_address: "172.16.1.100"
1160 aliases:
1161 - sleepyzz
1162 links:
1163 - db_test:db
1164 - name: TestingNet2
1165
1166 - name: Start a container with a command
1167 community.docker.docker_container:
1168 name: sleepy
1169 image: ubuntu:14.04
1170 command: ["sleep", "infinity"]
1171
1172 - name: Add container to networks
1173 community.docker.docker_container:
1174 name: sleepy
1175 networks:
1176 - name: TestingNet
1177 ipv4_address: 172.16.1.18
1178 links:
1179 - sleeper
1180 - name: TestingNet2
1181 ipv4_address: 172.16.10.20
1182
1183 - name: Update network with aliases
1184 community.docker.docker_container:
1185 name: sleepy
1186 networks:
1187 - name: TestingNet
1188 aliases:
1189 - sleepyz
1190 - zzzz
1191
1192 - name: Remove container from one network
1193 community.docker.docker_container:
1194 name: sleepy
1195 networks:
1196 - name: TestingNet2
1197 comparisons:
1198 networks: strict
1199
1200 - name: Remove container from all networks
1201 community.docker.docker_container:
1202 name: sleepy
1203 comparisons:
1204 networks: strict
1205
1206 - name: Start a container and use an env file
1207 community.docker.docker_container:
1208 name: agent
1209 image: jenkinsci/ssh-slave
1210 env_file: /var/tmp/jenkins/agent.env
1211
1212 - name: Create a container with limited capabilities
1213 community.docker.docker_container:
1214 name: sleepy
1215 image: ubuntu:16.04
1216 command: sleep infinity
1217 capabilities:
1218 - sys_time
1219 cap_drop:
1220 - all
1221
1222 - name: Finer container restart/update control
1223 community.docker.docker_container:
1224 name: test
1225 image: ubuntu:18.04
1226 env:
1227 arg1: "true"
1228 arg2: "whatever"
1229 volumes:
1230 - /tmp:/tmp
1231 comparisons:
1232 image: ignore # do not restart containers with older versions of the image
1233 env: strict # we want precisely this environment
1234 volumes: allow_more_present # if there are more volumes, that's ok, as long as `/tmp:/tmp` is there
1235
1236 - name: Finer container restart/update control II
1237 community.docker.docker_container:
1238 name: test
1239 image: ubuntu:18.04
1240 env:
1241 arg1: "true"
1242 arg2: "whatever"
1243 comparisons:
1244 '*': ignore # by default, ignore *all* options (including image)
1245 env: strict # except for environment variables; there, we want to be strict
1246
1247 - name: Start container with healthstatus
1248 community.docker.docker_container:
1249 name: nginx-proxy
1250 image: nginx:1.13
1251 state: started
1252 healthcheck:
1253 # Check if nginx server is healthy by curl'ing the server.
1254 # If this fails or timeouts, the healthcheck fails.
1255 test: ["CMD", "curl", "--fail", "http://nginx.host.com"]
1256 interval: 1m30s
1257 timeout: 10s
1258 retries: 3
1259 start_period: 30s
1260 start_interval: 10s
1261
1262 - name: Remove healthcheck from container
1263 community.docker.docker_container:
1264 name: nginx-proxy
1265 image: nginx:1.13
1266 state: started
1267 healthcheck:
1268 # The "NONE" check needs to be specified
1269 test: ["NONE"]
1270
1271 - name: Create a tmpfs with a size and mode
1272 community.docker.docker_container:
1273 name: tmpfs test
1274 image: ubuntu:22.04
1275 state: started
1276 mounts:
1277 - type: tmpfs
1278 target: /cache
1279 tmpfs_mode: "1700" # only readable to the owner
1280 tmpfs_size: "16G"
1281
1282 - name: Start container with block device read limit
1283 community.docker.docker_container:
1284 name: test
1285 image: ubuntu:18.04
1286 state: started
1287 device_read_bps:
1288 # Limit read rate for /dev/sda to 20 mebibytes per second
1289 - path: /dev/sda
1290 rate: 20M
1291 device_read_iops:
1292 # Limit read rate for /dev/sdb to 300 IO per second
1293 - path: /dev/sdb
1294 rate: 300
1295
1296 - name: Start container with GPUs
1297 community.docker.docker_container:
1298 name: test
1299 image: ubuntu:18.04
1300 state: started
1301 device_requests:
1302 # Add some specific devices to this container
1303 - device_ids:
1304 - '0'
1305 - 'GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a'
1306 # Add nVidia GPUs to this container
1307 - driver: nvidia
1308 count: -1 # this means we want all
1309 capabilities:
1310 # We have one OR condition: 'gpu' AND 'utility'
1311 - - gpu
1312 - utility
1313 # See https://github.com/NVIDIA/nvidia-container-runtime#supported-driver-capabilities
1314 # for a list of capabilities supported by the nvidia driver
1315
1316 - name: Start container with storage options
1317 community.docker.docker_container:
1318 name: test
1319 image: ubuntu:18.04
1320 state: started
1321 storage_opts:
1322 # Limit root filesystem to 12 MB - note that this requires special storage backends
1323 # (https://fabianlee.org/2020/01/15/docker-use-overlay2-with-an-xfs-backing-filesystem-to-limit-rootfs-size/)
1324 size: 12m
1325 """
1326
1327 RETURN = r"""
1328 container:
1329 description:
1330 - Facts representing the current state of the container. Matches the docker inspection output.
1331 - Empty if O(state=absent).
1332 - If O(detach=false), will include C(Output) attribute containing any output from container run.
1333 returned: success; or when O(state=started) and O(detach=false), and when waiting for the container result did not fail
1334 type: dict
1335 sample: '{ "AppArmorProfile": "", "Args": [], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false,
1336 "Cmd": [ "/usr/bin/supervisord" ], "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
1337 ], "ExposedPorts": { "443/tcp": {}, "80/tcp": {} }, "Hostname": "8e47bf643eb9", "Image": "lnmp_nginx:v1", "Labels": {},
1338 "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/tmp/lnmp/nginx-sites/logs/":
1339 {} }, ... }'
1340 status:
1341 description:
1342 - In case a container is started without detaching, this contains the exit code of the process in the container.
1343 - Before community.docker 1.1.0, this was only returned when non-zero.
1344 returned: when O(state=started) and O(detach=false), and when waiting for the container result did not fail
1345 type: int
1346 sample: 0
1347 """
1348
1349 from ansible_collections.community.docker.plugins.module_utils._module_container.docker_api import (
1350 DockerAPIEngineDriver,
1351 )
1352 from ansible_collections.community.docker.plugins.module_utils._module_container.module import (
1353 run_module,
1354 )
1355
1356
1357 def main() -> None:
1358 engine_driver = DockerAPIEngineDriver()
1359 run_module(engine_driver)
1360
1361
1362 if __name__ == "__main__":
1363 main()