Class: Ansible::Ruby::Modules::Docker
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Docker
- Defined in:
- lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb
Overview
This is the original Ansible module for managing the Docker container life cycle. NOTE: Additional and newer modules are available. For the latest on orchestrating containers with Ansible visit our Getting Started with Docker Guide at github.com/ansible/ansible/blob/devel/docsite/rst/guide_docker.rst.
Instance Method Summary collapse
-
#cap_add ⇒ Boolean?
Add capabilities for the container.
-
#cap_drop ⇒ Boolean?
Drop capabilities for the container.
-
#command ⇒ String?
Command used to match and launch containers.
-
#count ⇒ Integer?
Number of matching containers that should be in the desired state.
-
#cpu_set ⇒ Object?
CPUs in which to allow execution.
-
#cpu_shares ⇒ Integer?
CPU shares (relative weight).
-
#detach ⇒ Boolean?
Enable detached mode to leave the container running in background.
-
#devices ⇒ Array<String>, ...
List of host devices to expose to container.
-
#dns ⇒ Object?
List of custom DNS servers for the container.
-
#docker_api_version ⇒ String?
Remote API version to use.
-
#docker_url ⇒ String?
URL of the host running the docker daemon.
-
#docker_user ⇒ Object?
Username or UID to use within the container.
-
#domainname ⇒ Object?
Container domain name.
-
#email ⇒ Object?
Remote API email.
-
#entrypoint ⇒ Object?
Corresponds to “–entrypoint“ option of “docker run“ command and “ENTRYPOINT“ directive of Dockerfile.
-
#env ⇒ Hash?
Pass a dict of environment variables to the container.
-
#env_file ⇒ Object?
Pass in a path to a file with environment variable (FOO=BAR).
-
#expose ⇒ Array<Integer>, ...
List of additional container ports to expose for port mappings or links.
-
#extra_hosts ⇒ Hash?
Dict of custom host-to-IP mappings to be defined in the container.
-
#hostname ⇒ Object?
Container hostname.
-
#image ⇒ String
Container image used to match and launch containers.
-
#insecure_registry ⇒ Boolean?
Use insecure private registry by HTTP instead of HTTPS.
-
#labels ⇒ Object?
Set container labels.
-
#links ⇒ Array<String>, ...
List of other containers to link within this container with an optional,alias.
-
#log_driver ⇒ :"json-file", ...
You can specify a different logging driver for the container than for the daemon.
-
#log_opt ⇒ Hash?
Additional options to pass to the logging driver selected above.
-
#lxc_conf ⇒ Object?
LXC configuration parameters, such as C(lxc.aa_profile:unconfined).
-
#memory_limit ⇒ Integer?
RAM allocated to the container as a number of bytes or as a human-readable string like “512MB”.
-
#name ⇒ String?
Name used to match and uniquely name launched containers.
-
#net ⇒ Boolean?
Network mode for the launched container: bridge, none, container:<name|id>,or host.
-
#password ⇒ Object?
Remote API password.
-
#pid ⇒ Object?
Set the PID namespace mode for the container (currently only supports ‘host’).
-
#ports ⇒ Array<String>, ...
List containing private to public port mapping specification.
-
#privileged ⇒ Boolean?
Whether the container should run in privileged mode or not.
-
#publish_all_ports ⇒ Boolean?
Publish all exposed ports to the host interfaces.
-
#pull ⇒ :missing, ...
Control when container images are updated from the C(docker_url) registry.
-
#read_only ⇒ Object?
Mount the container’s root filesystem as read only.
-
#registry ⇒ String?
Remote registry URL to pull images from.
-
#restart_policy ⇒ :no, ...
Container restart policy.,The ‘unless-stopped’ choice is only available starting in Ansible 2.1 and for Docker 1.9 and above.
-
#restart_policy_retry ⇒ Integer?
Maximum number of times to restart a container.
-
#signal ⇒ String?
With the state “killed”, you can alter the signal sent to the container.
-
#state ⇒ :present, ...
Assert the container’s desired state.
-
#stdin_open ⇒ Boolean?
Keep stdin open after a container is launched.
-
#stop_timeout ⇒ Integer?
How many seconds to wait for the container to stop before killing it.
-
#timeout ⇒ Integer?
Docker daemon response timeout in seconds.
-
#tls_ca_cert ⇒ String?
Path to a PEM-encoded certificate authority to secure the Docker connection.
-
#tls_client_cert ⇒ String?
Path to the PEM-encoded certificate used to authenticate docker client.
-
#tls_client_key ⇒ String?
Path to the PEM-encoded key used to authenticate docker client.
-
#tls_hostname ⇒ String?
A hostname to check matches what’s supplied in the docker server’s certificate.
-
#tty ⇒ Boolean?
Allocate a pseudo-tty within the container.
-
#ulimits ⇒ Object?
Ulimits, list ulimits with name, soft and optionally hard limit separated by colons.
-
#use_tls ⇒ :no, ...
Whether to use tls to connect to the docker server.
-
#username ⇒ Object?
Remote API username.
-
#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).
-
#volumes_from ⇒ Array<String>, ...
List of names of containers to mount volumes from.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#cap_add ⇒ Boolean?
Returns Add capabilities for the container. Requires docker-py >= 0.5.0.
191 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 191 attribute :cap_add |
#cap_drop ⇒ Boolean?
Returns Drop capabilities for the container. Requires docker-py >= 0.5.0.
195 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 195 attribute :cap_drop |
#command ⇒ String?
Returns Command used to match and launch containers.
27 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 27 attribute :command |
#count ⇒ Integer?
Returns Number of matching containers that should be in the desired state.
12 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 12 attribute :count |
#cpu_set ⇒ Object?
Returns CPUs in which to allow execution. Requires docker-py >= 0.6.0.
188 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 188 attribute :cpu_set |
#cpu_shares ⇒ Integer?
Returns CPU shares (relative weight). Requires docker-py >= 0.6.0.
210 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 210 attribute :cpu_shares |
#detach ⇒ Boolean?
Returns Enable detached mode to leave the container running in background. If disabled, fail unless the process exits cleanly.
131 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 131 attribute :detach |
#devices ⇒ Array<String>, ...
Returns List of host devices to expose to container.
59 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 59 attribute :devices |
#dns ⇒ Object?
Returns List of custom DNS servers for the container.
128 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 128 attribute :dns |
#docker_api_version ⇒ String?
Returns Remote API version to use. This defaults to the current default as specified by docker-py.
99 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 99 attribute :docker_api_version |
#docker_url ⇒ String?
Returns URL of the host running the docker daemon. This will default to the env var DOCKER_HOST if unspecified.
75 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 75 attribute :docker_url |
#docker_user ⇒ Object?
Returns Username or UID to use within the container.
103 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 103 attribute :docker_user |
#domainname ⇒ Object?
Returns Container domain name.
118 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 118 attribute :domainname |
#email ⇒ Object?
Returns Remote API email.
112 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 112 attribute :email |
#entrypoint ⇒ Object?
Returns Corresponds to “–entrypoint“ option of “docker run“ command and “ENTRYPOINT“ directive of Dockerfile. Used to match and launch containers.
24 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 24 attribute :entrypoint |
#env ⇒ Hash?
Returns Pass a dict of environment variables to the container.
121 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 121 attribute :env |
#env_file ⇒ Object?
Returns Pass in a path to a file with environment variable (FOO=BAR). If a key value is present in both explicitly presented (i.e. as ‘env’) and in the environment file, the explicit value will override. Requires docker-py >= 1.4.0.
125 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 125 attribute :env_file |
#expose ⇒ Array<Integer>, ...
Returns List of additional container ports to expose for port mappings or links. If the port is already exposed using EXPOSE in a Dockerfile, you don’t need to expose it again.
39 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 39 attribute :expose |
#extra_hosts ⇒ Hash?
Returns Dict of custom host-to-IP mappings to be defined in the container.
180 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 180 attribute :extra_hosts |
#hostname ⇒ Object?
Returns Container hostname.
115 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 115 attribute :hostname |
#image ⇒ String
Returns Container image used to match and launch containers.
16 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 16 attribute :image |
#insecure_registry ⇒ Boolean?
Returns Use insecure private registry by HTTP instead of HTTPS. Needed for docker-py >= 0.5.0.
184 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 184 attribute :insecure_registry |
#labels ⇒ Object?
Returns Set container labels. Requires docker >= 1.6 and docker-py >= 1.2.0.
199 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 199 attribute :labels |
#links ⇒ Array<String>, ...
Returns List of other containers to link within this container with an optional,alias. Use docker CLI-style syntax: C(redis:myredis).
55 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 55 attribute :links |
#log_driver ⇒ :"json-file", ...
Returns You can specify a different logging driver for the container than for the daemon. “json-file” Default logging driver for Docker. Writes JSON messages to file. docker logs command is available only for this logging driver. “none” disables any logging for the container. “syslog” Syslog logging driver for Docker. Writes log messages to syslog. docker logs command is not available for this logging driver. “journald” Journald logging driver for Docker. Writes log messages to “journald”. “gelf” Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. “fluentd” Fluentd logging driver for Docker. Writes log messages to “fluentd” (forward input). “awslogs” (added in 2.1) Awslogs logging driver for Docker. Writes log messages to AWS Cloudwatch Logs. If not defined explicitly, the Docker daemon’s default (“json-file”) will apply. Requires docker >= 1.6.0.
63 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 63 attribute :log_driver |
#log_opt ⇒ Hash?
Returns Additional options to pass to the logging driver selected above. See Docker ‘log-driver <docs.docker.com/reference/logging/overview/>` documentation for more information. Requires docker >=1.7.0.
67 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 67 attribute :log_opt |
#lxc_conf ⇒ Object?
Returns LXC configuration parameters, such as C(lxc.aa_profile:unconfined).
147 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 147 attribute :lxc_conf |
#memory_limit ⇒ Integer?
Returns RAM allocated to the container as a number of bytes or as a human-readable string like “512MB”. Leave as “0” to specify no limit.
71 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 71 attribute :memory_limit |
#name ⇒ String?
Returns Name used to match and uniquely name launched containers. Explicit names are used to uniquely identify a single container or to link among containers. Mutually exclusive with a “count” other than “1”.
31 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 31 attribute :name |
#net ⇒ Boolean?
Returns Network mode for the launched container: bridge, none, container:<name|id>,or host. Requires docker >= 0.11.
158 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 158 attribute :net |
#password ⇒ Object?
Returns Remote API password.
109 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 109 attribute :password |
#pid ⇒ Object?
Returns Set the PID namespace mode for the container (currently only supports ‘host’). Requires docker-py >= 1.0.0 and docker >= 1.5.0.
162 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 162 attribute :pid |
#ports ⇒ Array<String>, ...
Returns List containing private to public port mapping specification. Use docker ‘CLI-style 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. The container ports need to be exposed either in the Dockerfile or via the C(expose) option.
35 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 35 attribute :ports |
#privileged ⇒ Boolean?
Returns Whether the container should run in privileged mode or not.
143 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 143 attribute :privileged |
#publish_all_ports ⇒ Boolean?
Returns Publish all exposed ports to the host interfaces.
43 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 43 attribute :publish_all_ports |
#pull ⇒ :missing, ...
Returns Control when container images are updated from the C(docker_url) registry. If “missing,” images will be pulled only when missing from the host; if ‘“always,” the registry will be checked for a newer version of the image’ each time the task executes.
20 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 20 attribute :pull |
#read_only ⇒ Object?
Returns Mount the container’s root filesystem as read only.
169 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 169 attribute :read_only |
#registry ⇒ String?
Returns Remote registry URL to pull images from.
165 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 165 attribute :registry |
#restart_policy ⇒ :no, ...
Returns Container restart policy.,The ‘unless-stopped’ choice is only available starting in Ansible 2.1 and for Docker 1.9 and above.
172 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 172 attribute :restart_policy |
#restart_policy_retry ⇒ Integer?
Returns Maximum number of times to restart a container. Leave as “0” for unlimited retries.
176 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 176 attribute :restart_policy_retry |
#signal ⇒ String?
Returns With the state “killed”, you can alter the signal sent to the container.
135 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 135 attribute :signal |
#state ⇒ :present, ...
Returns Assert the container’s desired state. “present” only asserts that the matching containers exist. “started” asserts that the matching containers both exist and are running, but takes no action if any configuration has changed. “reloaded” (added in Ansible 1.9) asserts that all matching containers are running and restarts any that have any images or configuration out of date. “restarted” unconditionally restarts (or starts) the matching containers. “stopped” and ‘“killed” stop and kill all matching containers. “absent” stops and then’ removes any matching containers.
139 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 139 attribute :state |
#stdin_open ⇒ Boolean?
Returns Keep stdin open after a container is launched.
150 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 150 attribute :stdin_open |
#stop_timeout ⇒ Integer?
Returns How many seconds to wait for the container to stop before killing it.
202 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 202 attribute :stop_timeout |
#timeout ⇒ Integer?
Returns Docker daemon response timeout in seconds.
206 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 206 attribute :timeout |
#tls_ca_cert ⇒ String?
Returns Path to a PEM-encoded certificate authority to secure the Docker connection. This has no effect if use_tls is encrypt.
91 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 91 attribute :tls_ca_cert |
#tls_client_cert ⇒ String?
Returns Path to the PEM-encoded certificate used to authenticate docker client. If specified tls_client_key must be valid.
83 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 83 attribute :tls_client_cert |
#tls_client_key ⇒ String?
Returns Path to the PEM-encoded key used to authenticate docker client. If specified tls_client_cert must be valid.
87 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 87 attribute :tls_client_key |
#tls_hostname ⇒ String?
Returns A hostname to check matches what’s supplied in the docker server’s certificate. If unspecified, the hostname is taken from the docker_url.
95 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 95 attribute :tls_hostname |
#tty ⇒ Boolean?
Returns Allocate a pseudo-tty within the container.
154 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 154 attribute :tty |
#ulimits ⇒ Object?
Returns ulimits, list ulimits with name, soft and optionally hard limit separated by colons. e.g. nofile:1024:2048 Requires docker-py >= 1.2.0 and docker >= 1.6.0.
214 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 214 attribute :ulimits |
#use_tls ⇒ :no, ...
Returns Whether to use tls to connect to the docker server. “no” means not to use tls (and ignore any other tls related parameters). “encrypt” means to use tls to encrypt the connection to the server. “verify” means to also verify that the server’s certificate is valid for the server (this both verifies the certificate against the CA and that the certificate was issued for that host. If this is unspecified, tls will only be used if one of the other tls options require it.
79 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 79 attribute :use_tls |
#username ⇒ Object?
Returns Remote API username.
106 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 106 attribute :username |
#volumes ⇒ Array<String>, ...
Returns 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). Starting at version 2.1, SELinux hosts can additionally use C(z) or C(Z) mount options to use a shared or private label for the volume.
47 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 47 attribute :volumes |
#volumes_from ⇒ Array<String>, ...
Returns List of names of containers to mount volumes from.
51 |
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 51 attribute :volumes_from |