mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Add 'init' option to docker_container module to support docker's --init
option (#34547)
* Add support for `--init` option to `docker_container` module Fixes #30761 * Validate docker API's version when docker_container's init option is True https://github.com/ansible/ansible/pull/34547#pullrequestreview-122355244 https://docs.docker.com/engine/reference/commandline/run/#options init option requires docker API 1.25+ . * Fix failure of sanity test
This commit is contained in:
parent
d9533c3cbf
commit
38c86b7eef
2 changed files with 15 additions and 1 deletions
|
@ -139,6 +139,13 @@ options:
|
|||
description:
|
||||
- Repository path and tag used to create the container. If an image is not found or pull is true, the image
|
||||
will be pulled from the registry. If no tag is included, 'latest' will be used.
|
||||
init:
|
||||
description:
|
||||
- Run an init inside the container that forwards signals and reaps processes.
|
||||
This option requires Docker API 1.25+.
|
||||
type: bool
|
||||
default: 'no'
|
||||
version_added: "2.6"
|
||||
interactive:
|
||||
description:
|
||||
- Keep stdin open after a container is launched, even if not attached.
|
||||
|
@ -653,6 +660,7 @@ class TaskParameters(DockerBaseClass):
|
|||
self.hostname = None
|
||||
self.ignore_image = None
|
||||
self.image = None
|
||||
self.init = None
|
||||
self.interactive = None
|
||||
self.ipc_mode = None
|
||||
self.keep_volumes = None
|
||||
|
@ -898,7 +906,8 @@ class TaskParameters(DockerBaseClass):
|
|||
group_add='groups',
|
||||
devices='devices',
|
||||
pid_mode='pid_mode',
|
||||
tmpfs='tmpfs'
|
||||
tmpfs='tmpfs',
|
||||
init='init'
|
||||
)
|
||||
|
||||
if HAS_DOCKER_PY_2 or HAS_DOCKER_PY_3:
|
||||
|
@ -1999,6 +2008,7 @@ def main():
|
|||
hostname=dict(type='str'),
|
||||
ignore_image=dict(type='bool', default=False),
|
||||
image=dict(type='str'),
|
||||
init=dict(type='bool', default=False),
|
||||
interactive=dict(type='bool', default=False),
|
||||
ipc_mode=dict(type='str'),
|
||||
keep_volumes=dict(type='bool', default=True),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue