Class: Ansible::Ruby::Modules::Docker_container
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Docker_container
- Defined in:
- lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb,
lib/ansible/ruby/modules/custom/cloud/core/docker/docker_container.rb
Overview
Manage the life cycle of docker containers. Supports check mode. Run with –check and –diff to view config difference and list of actions to be taken.
Instance Method Summary collapse
-
#auto_remove ⇒ :yes, ...
Enable auto-removal of the container on daemon side when the container’s process exits.
-
#blkio_weight ⇒ Object?
Block IO (relative weight), between 10 and 1000.
-
#cap_drop ⇒ Array<String>, ...
List of capabilities to drop from the container.
-
#capabilities ⇒ Array<String>, ...
List of capabilities to add to the container.
-
#cleanup ⇒ :yes, ...
Use with I(detach=false) to remove the container after successful execution.
-
#command ⇒ Array<String>, ...
Command to execute when the container starts.
-
#cpu_period ⇒ Integer?
Limit CPU CFS (Completely Fair Scheduler) period.
-
#cpu_quota ⇒ Integer?
Limit CPU CFS (Completely Fair Scheduler) quota.
-
#cpu_shares ⇒ Object?
CPU shares (relative weight).
-
#cpuset_cpus ⇒ Object?
CPUs in which to allow execution C(1,3) or C(1-3).
-
#cpuset_mems ⇒ Object?
Memory nodes (MEMs) in which to allow execution C(0-3) or C(0,1).
-
#detach ⇒ Boolean?
Enable detached mode to leave the container running in background.
-
#devices ⇒ Array<String>, ...
List of host device bindings to add to the container.
-
#dns_opts ⇒ Object?
List of DNS options.
-
#dns_search_domains ⇒ Object?
List of custom DNS search domains.
-
#dns_servers ⇒ Object?
List of custom DNS servers.
-
#domainname ⇒ Object?
Container domainname.
-
#entrypoint ⇒ Object?
Command that overwrites the default ENTRYPOINT of the image.
-
#env ⇒ Hash?
Dictionary of key,value pairs.
-
#env_file ⇒ String?
Path to a file, present on the target, containing environment variables I(FOO=BAR).,If variable also present in C(env), then C(env) value will override.
-
#etc_hosts ⇒ Object?
Dict of host-to-IP mappings, where each host name is a key in the dictionary.
-
#exposed_ports ⇒ Array<Integer>, ...
List of additional container ports which informs Docker that the container listens on the specified network ports at runtime.
-
#force_kill ⇒ :yes, ...
Use the kill command when stopping a running container.
-
#groups ⇒ Object?
List of additional group names and/or IDs that the container process will run as.
-
#hostname ⇒ Object?
Container hostname.
-
#ignore_image ⇒ :yes, ...
When C(state) is I(present) or I(started) the module compares the configuration of an existing container to requested configuration.
-
#image ⇒ String?
Repository path and tag used to create the container.
-
#init ⇒ :yes, ...
Run an init inside the container that forwards signals and reaps processes.
-
#interactive ⇒ :yes, ...
Keep stdin open after a container is launched, even if not attached.
-
#ipc_mode ⇒ Object?
Set the IPC mode for the container.
-
#keep_volumes ⇒ :yes, ...
Retain volumes associated with a removed container.
-
#kernel_memory ⇒ Integer?
Kernel memory limit (format: C(<number>)).
-
#kill_signal ⇒ Object?
Override default signal used to kill a running container.
-
#labels ⇒ Object?
Dictionary of key value pairs.
-
#links ⇒ Array<String>, ...
List of name aliases for linked containers in the format C(container_name:alias).,Setting this will force container to be restarted.
-
#log_driver ⇒ String?
Specify the logging driver.
-
#log_options ⇒ Hash?
Dictionary of options specific to the chosen log_driver.
-
#mac_address ⇒ Object?
Container MAC address (e.g. 92:d0:c6:0a:29:33).
-
#memory ⇒ String?
Memory limit (format: C(<number>)).
-
#memory_reservation ⇒ Integer?
Memory soft limit (format: C(<number>)).
-
#memory_swap ⇒ Integer?
Total memory limit (memory + swap, format: C(<number>)).
-
#memory_swappiness ⇒ Object?
Tune a container’s memory swappiness behavior.
-
#name ⇒ String
Assign a name to a new container or match an existing container.,When identifying an existing container name may be a name or a long or short container ID.
-
#network_mode ⇒ Object?
Connect the container to a network.
-
#networks ⇒ Array<Hash>, ...
List of networks the container belongs to.,Each network is a dict with keys C(name), C(ipv4_address), C(ipv6_address), C(links), C(aliases).,For each network C(name) is required, all other keys are optional.,If included, C(links) or C(aliases) are lists.,For examples of the data structure and usage see EXAMPLES below.,To remove a container from one or more networks, use the C(purge_networks) option.,Note that as opposed to C(docker run …), M(docker_container) does not remove the default network if C(networks) is specified.
-
#oom_killer ⇒ :yes, ...
Whether or not to disable OOM Killer for the container.
-
#oom_score_adj ⇒ Integer?
An integer value containing the score given to the container in order to tune OOM killer preferences.
-
#output_logs ⇒ :yes, ...
If set to true, output of the container command will be printed (only effective when log_driver is set to json-file or journald..
-
#paused ⇒ :yes, ...
Use with the started state to pause running processes inside the container.
-
#pid_mode ⇒ Object?
Set the PID namespace mode for the container.
-
#privileged ⇒ :yes, ...
Give extended privileges to the container.
-
#published_ports ⇒ Object?
List of ports to publish from the container to the host.,Use docker CLI syntax: C(8000), C(9000:8000), or C(0.0.0.0:9000:8000), where 8000 is a container port, 9000 is a host port, and 0.0.0.0 is a host interface.,Container ports must be exposed either in the Dockerfile or via the C(expose) option.,A value of C(all) will publish all exposed container ports to random host ports, ignoring any other mappings.,If C(networks) parameter is provided, will inspect each network to see if there exists a bridge network with optional parameter com.docker.network.bridge.host_binding_ipv4.
-
#pull ⇒ :yes, ...
If true, always pull the latest version of an image.
-
#purge_networks ⇒ :yes, ...
Remove the container from ALL networks not included in C(networks) parameter.,Any default networks such as I(bridge), if not found in C(networks), will be removed as well.
-
#read_only ⇒ :yes, ...
Mount the container’s root file system as read-only.
-
#recreate ⇒ :yes, ...
Use with present and started states to force the re-creation of an existing container.
-
#restart ⇒ :yes, ...
Use with started state to force a matching container to be stopped and restarted.
-
#restart_policy ⇒ :no, ...
Container restart policy.
-
#restart_retries ⇒ Integer?
Use with restart policy to control maximum number of restart attempts.
-
#security_opts ⇒ Object?
List of security options in the form of C(“label:user:User”).
-
#shm_size ⇒ Object?
Size of C(/dev/shm) (format: C(<number>)).
-
#state ⇒ :absent, ...
I(absent) - A container matching the specified name will be stopped and removed.
-
#stop_signal ⇒ Object?
Override default signal used to stop the container.
-
#stop_timeout ⇒ Object?
Number of seconds to wait for the container to stop before sending SIGKILL.
-
#sysctls ⇒ Object?
Dictionary of key,value pairs.
-
#tmpfs ⇒ Object?
Mount a tmpfs directory.
- #to_h ⇒ Object
-
#trust_image_content ⇒ :yes, ...
If C(yes), skip image verification.
-
#tty ⇒ :yes, ...
Allocate a pseudo-TTY.
-
#ulimits ⇒ Object?
List of ulimit options.
-
#user ⇒ Object?
Sets the username or UID used and optionally the groupname or GID for the specified command.,Can be [ user | user:group | uid | uid:gid | user:gid | uid:group ].
-
#userns_mode ⇒ Object?
User namespace to use.
-
#uts ⇒ Object?
Set the UTS namespace mode for the container.
-
#volume_driver ⇒ Object?
The container volume driver.
-
#volumes ⇒ Array<String>, ...
List of volumes to mount within the container.,Use docker CLI-style syntax: C(/host:/container),You can specify a read mode for the mount with either C(ro) or C(rw).,SELinux hosts can additionally use C(z) or C(Z) to use a shared or private label for the volume.
-
#volumes_from ⇒ Array<String>, ...
List of container names or Ids to get volumes from.
-
#working_dir ⇒ Object?
Path to the working directory.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#auto_remove ⇒ :yes, ...
13 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 13 attribute :auto_remove |
#blkio_weight ⇒ Object?
17 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 17 attribute :blkio_weight |
#cap_drop ⇒ Array<String>, ...
24 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 24 attribute :cap_drop |
#capabilities ⇒ Array<String>, ...
20 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 20 attribute :capabilities |
#cleanup ⇒ :yes, ...
28 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 28 attribute :cleanup |
#command ⇒ Array<String>, ...
32 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 32 attribute :command |
#cpu_period ⇒ Integer?
36 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 36 attribute :cpu_period |
#cpu_quota ⇒ Integer?
40 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 40 attribute :cpu_quota |
#cpu_shares ⇒ Object?
50 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 50 attribute :cpu_shares |
#cpuset_cpus ⇒ Object?
44 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 44 attribute :cpuset_cpus |
#cpuset_mems ⇒ Object?
47 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 47 attribute :cpuset_mems |
#detach ⇒ Boolean?
53 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 53 attribute :detach |
#devices ⇒ Array<String>, ...
57 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 57 attribute :devices |
#dns_opts ⇒ Object?
61 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 61 attribute :dns_opts |
#dns_search_domains ⇒ Object?
67 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 67 attribute :dns_search_domains |
#dns_servers ⇒ Object?
64 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 64 attribute :dns_servers |
#domainname ⇒ Object?
70 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 70 attribute :domainname |
#entrypoint ⇒ Object?
81 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 81 attribute :entrypoint |
#env ⇒ Hash?
73 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 73 attribute :env |
#env_file ⇒ String?
77 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 77 attribute :env_file |
#etc_hosts ⇒ Object?
84 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 84 attribute :etc_hosts |
#exposed_ports ⇒ Array<Integer>, ...
87 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 87 attribute :exposed_ports |
#force_kill ⇒ :yes, ...
91 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 91 attribute :force_kill |
#groups ⇒ Object?
95 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 95 attribute :groups |
#hostname ⇒ Object?
98 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 98 attribute :hostname |
#ignore_image ⇒ :yes, ...
101 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 101 attribute :ignore_image |
#image ⇒ String?
105 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 105 attribute :image |
#init ⇒ :yes, ...
109 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 109 attribute :init |
#interactive ⇒ :yes, ...
113 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 113 attribute :interactive |
#ipc_mode ⇒ Object?
117 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 117 attribute :ipc_mode |
#keep_volumes ⇒ :yes, ...
120 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 120 attribute :keep_volumes |
#kernel_memory ⇒ Integer?
127 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 127 attribute :kernel_memory |
#kill_signal ⇒ Object?
124 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 124 attribute :kill_signal |
#labels ⇒ Object?
131 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 131 attribute :labels |
#links ⇒ Array<String>, ...
134 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 134 attribute :links |
#log_driver ⇒ String?
138 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 138 attribute :log_driver |
#log_options ⇒ Hash?
142 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 142 attribute :log_options |
#mac_address ⇒ Object?
146 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 146 attribute :mac_address |
#memory ⇒ String?
149 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 149 attribute :memory |
#memory_reservation ⇒ Integer?
153 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 153 attribute :memory_reservation |
#memory_swap ⇒ Integer?
157 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 157 attribute :memory_swap |
#memory_swappiness ⇒ Object?
161 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 161 attribute :memory_swappiness |
#name ⇒ String
164 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 164 attribute :name |
#network_mode ⇒ Object?
168 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 168 attribute :network_mode |
#networks ⇒ Array<Hash>, ...
174 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 174 attribute :networks |
#oom_killer ⇒ :yes, ...
178 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 178 attribute :oom_killer |
#oom_score_adj ⇒ Integer?
182 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 182 attribute :oom_score_adj |
#output_logs ⇒ :yes, ...
186 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 186 attribute :output_logs |
#paused ⇒ :yes, ...
190 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 190 attribute :paused |
#pid_mode ⇒ Object?
194 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 194 attribute :pid_mode |
#privileged ⇒ :yes, ...
197 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 197 attribute :privileged |
#published_ports ⇒ Object?
201 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 201 attribute :published_ports |
#pull ⇒ :yes, ...
204 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 204 attribute :pull |
#purge_networks ⇒ :yes, ...
208 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 208 attribute :purge_networks |
#read_only ⇒ :yes, ...
212 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 212 attribute :read_only |
#recreate ⇒ :yes, ...
216 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 216 attribute :recreate |
#restart ⇒ :yes, ...
220 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 220 attribute :restart |
#restart_policy ⇒ :no, ...
224 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 224 attribute :restart_policy |
#restart_retries ⇒ Integer?
228 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 228 attribute :restart_retries |
#security_opts ⇒ Object?
235 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 235 attribute :security_opts |
#shm_size ⇒ Object?
232 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 232 attribute :shm_size |
#state ⇒ :absent, ...
238 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 238 attribute :state |
#stop_signal ⇒ Object?
242 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 242 attribute :stop_signal |
#stop_timeout ⇒ Object?
245 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 245 attribute :stop_timeout |
#sysctls ⇒ Object?
262 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 262 attribute :sysctls |
#tmpfs ⇒ Object?
252 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 252 attribute :tmpfs |
#to_h ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ansible/ruby/modules/custom/cloud/core/docker/docker_container.rb', line 18 def to_h result = super data = result[:docker_container] data[:volumes] = transform_volumes data[:volumes] if data.include? :volumes result end |
#trust_image_content ⇒ :yes, ...
248 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 248 attribute :trust_image_content |
#tty ⇒ :yes, ...
255 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 255 attribute :tty |
#ulimits ⇒ Object?
259 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 259 attribute :ulimits |
#user ⇒ Object?
265 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 265 attribute :user |
#userns_mode ⇒ Object?
171 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 171 attribute :userns_mode |
#uts ⇒ Object?
268 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 268 attribute :uts |
#volume_driver ⇒ Object?
275 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 275 attribute :volume_driver |
#volumes ⇒ Array<String>, ...
271 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 271 attribute :volumes |
#volumes_from ⇒ Array<String>, ...
278 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 278 attribute :volumes_from |
#working_dir ⇒ Object?
282 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_container.rb', line 282 attribute :working_dir |