You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update documentation for container, exec and service (#1293)
* Update documentation for container, exec and service
Signed-off-by: Dan Webb <dan.webb@damacus.io>
* Update readme, and documentation folder
Signed-off-by: Dan Webb <dan.webb@damacus.io>
* Update readme, and documentation folder
Signed-off-by: Dan Webb <dan.webb@damacus.io>
* Fix default_script_url
Signed-off-by: Dan Webb <dan.webb@damacus.io>
---------
Signed-off-by: Dan Webb <dan.webb@damacus.io>
Copy file name to clipboardexpand all lines: documentation/docker_container.md
+146-66
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# docker_container
2
2
3
-
The `docker_container` is responsible for managing Docker container actions. It speaks directly to the [Docker remote API](https://docs.docker.com/reference/api/docker_remote_api_v1.20/).
3
+
The `docker_container`resource is responsible for managing Docker container actions. It speaks directly to the [Docker remote API](https://docs.docker.com/reference/api/docker_remote_api_v1.20/).
4
4
5
-
Containers are process oriented, and move through an event cycle.
5
+
Containers are process oriented and move through an event cycle.
6
6
7
7
## Actions
8
8
9
9
-`:create` - Creates the container but does not start it. Useful for Volume containers.
10
-
-`:start` - Starts the container. Useful for containers that run jobs.. command that exit.
10
+
-`:start` - Starts the container. Useful for containers that run jobs and exit.
11
11
-`:run` - The default action. Both `:create` and `:start` the container in one action. Redeploys the container on resource change.
12
12
-`:run_if_missing` - Runs a container only once.
13
13
-`:stop` - Stops the container.
@@ -23,82 +23,135 @@ Containers are process oriented, and move through an event cycle.
23
23
24
24
Most `docker_container` properties are the `snake_case` version of the `CamelCase` keys found in the [Docker Remote Api](https://docs.docker.com/reference/api/docker_remote_api_v1.20/)
25
25
26
+
### Core Properties
27
+
26
28
-`container_name` - The name of the container. Defaults to the name of the `docker_container` resource.
27
29
-`repo` - aka `image_name`. The first half of a the complete identifier for a Docker Image.
28
-
-`tag` - The second half of a Docker image's identity. - Defaults to `latest`.
30
+
-`tag` - The second half of a Docker image's identity. Defaults to `latest`.
29
31
-`command` - The command to run when starting the container.
30
-
-`autoremove` - Boolean - Automatically delete a container when it's command exits. Defaults to `false`.
31
-
-`volumes` - An array of volume bindings for this container. Each volume binding is a string in one of these forms: `container_path` to create a new volume for the container. `host_path:container_path` to bind-mount a host path into the container. `host_path:container_path:ro` to make the bind-mount read-only inside the container.
32
-
-`cap_add` - An array Linux Capabilities (`man 7 capabilities`) to add to grant the container beyond what it normally gets.
33
-
-`cap_drop` - An array Linux Capabilities (`man 7 capabilities`) to revoke that the container normally has.
32
+
-`working_dir` - A string specifying the working directory for commands to run in.
33
+
-`user` - A string value specifying the user inside the container.
34
+
35
+
### Resource Management
36
+
34
37
-`cpus` - A float or integer value specifying how much of the available CPU resources a container can use. Available in Docker 1.13 and higher.
35
38
-`cpu_shares` - An integer value containing the CPU Shares for the container.
36
-
-`devices` - A Hash of devices to add to the container.
37
-
-`dns` - An array of DNS servers the container will use for name resolution.
38
-
-`dns_search` - An array of domains the container will search for name resolution.
39
-
-`domain_name` - Set's the container's dnsdomainname as returned by the `dnsdomainname` command.
40
-
-`entrypoint` - Set the entry point for the container as a string or an array of strings.
41
-
-`env` - Set environment variables in the container in the form `['FOO=bar', 'BIZ=baz']`
42
-
-`env_file` - Read environment variables from a file and set in the container. Accepts an Array or String to the file location. lazy evaluator must be set if the file passed is created by Chef.
43
-
-`extra_hosts` - An array of hosts to add to the container's `/etc/hosts` in the form `['host_a:10.9.8.7', 'host_b:10.9.8.6']`
44
-
-`force` - A boolean to use in container operations that support a `force` option. Defaults to `false`
45
-
-`gpus` - GPU devices to add to the container. Use 'all' to pass all GPUs to the container.
46
-
-`gpu_driver` - GPU driver to use for container. Defaults to 'nvidia'.
47
-
-`health_check` - A hash containing the health check options - [healthcheck reference](https://docs.docker.com/engine/reference/run/#healthcheck)
48
-
-`host` - A string containing the host the API should communicate with. Defaults to ENV['DOCKER_HOST'] if set
49
-
-`host_name` - The hostname for the container.
50
-
-`labels` A string, array, or hash to set metadata on the container in the form `['foo:bar', 'hello:world']`
51
-
-`links` - An array of source container/alias pairs to link the container to in the form `[container_a:www', container_b:db']`
52
-
-`log_driver` - Sets a custom logging driver for the container (json-file/syslog/journald/gelf/fluentd/awslogs/splunk/etwlogs/gcplogs/logentries/loki-docker/local/none).
53
-
-`log_opts` - Configures the above logging driver options (driver-specific).
54
-
-`init` - Run an init inside the container that forwards signals and reaps processes.
-`mac_address` - The mac address for the container to use.
57
39
-`memory` - Memory limit in bytes.
58
-
-`memory_swap` - Total memory limit (memory + swap); set `-1` to disable swap limit (unlimited). You must use this with memory and make the swap value larger than memory.
40
+
-`memory_swap` - Total memory limit (memory + swap); set `-1` to disable swap limit (unlimited). Must be used with memory and set larger than memory.
41
+
-`shm_size` - The size of `/dev/shm`. Format is `<number><unit>`, where number must be greater than 0. Unit is optional: b (bytes), k (kilobytes), m (megabytes), or g (gigabytes). Default is `64m`.
42
+
43
+
### Storage and Volumes
44
+
45
+
-`volumes` - An array of volume bindings for this container. Each binding can be:
46
+
-`container_path` - Creates a new volume for the container
47
+
-`host_path:container_path` - Bind-mounts a host path into the container
48
+
-`host_path:container_path:ro` - Makes the bind-mount read-only inside the container
49
+
-`volumes_from` - A list of volumes to inherit from another container. Format: `<container name>[:<ro|rw>]`
50
+
-`volume_driver` - Driver that this container uses to mount volumes.
51
+
-`tmpfs` - A hash or array of tmpfs mounts to add to the container. Provides temporary filesystem without requiring privileged mode.
52
+
53
+
### Networking
54
+
55
+
-`network_mode` - Sets the networking mode for the container. One of:
56
+
-`bridge` - Default Docker bridge network
57
+
-`host` - Use the host's network stack inside the container
58
+
-`container:<name|id>` - Use another container's network stack
59
+
-`none` - No networking
59
60
-`network_disabled` - Boolean to disable networking. Defaults to `false`.
60
-
-`network_mode` - Sets the networking mode for the container. One of `bridge`, `host`, `container`.
61
61
-`network_aliases` - Adds network-scoped alias for the container in form `['alias-1', 'alias-2']`.
62
-
-`oom_kill_disable` - Whether to disable OOM Killer for the container or not.
63
-
-`oom_score_adj` - Tune container's OOM preferences (-1000 to 1000).
64
-
-`open_stdin` - Boolean value, opens stdin. Defaults to `false`.
65
-
-`outfile` - The path to write the file when using `:export` action.
66
-
-`port` - The port configuration to use in the container. Matches the syntax used by the `docker` CLI tool.
67
-
-`privileged` - Boolean to start the container in privileged more. Defaults to `false`
68
-
-`publish_all_ports` - Allocates a random host port for all of a container's exposed ports.
69
-
-`remove_volumes` - A boolean to clean up "dangling" volumes when removing the last container with a reference to it. Default to `false` to match the Docker CLI behavior.
70
-
-`restart_policy` - One of `no`, `on-failure`, `unless-stopped`, or `always`. Use `always` if you want a service container to survive a Dockerhost reboot. Defaults to `no`.
71
-
-`restart_maximum_retry_count` - Maximum number of restarts to try when `restart_policy` is `on-failure`. Defaults to an ever increasing delay (double the previous delay, starting at 100mS), to prevent flooding the server.
72
-
-`running_wait_time` - Amount of seconds `docker_container` wait to determine if a process is running.
73
-
-`runtime` - Runtime to use when running container. Defaults to `runc`.
62
+
-`hostname` - The hostname for the container.
63
+
-`domain_name` - Sets the container's dnsdomainname as returned by the `dnsdomainname` command.
64
+
-`dns` - An array of DNS servers the container will use for name resolution.
65
+
-`dns_search` - An array of domains the container will search for name resolution.
66
+
-`mac_address` - The mac address for the container to use.
-`privileged` - Boolean to start the container in privileged mode. Defaults to `false`.
72
+
-`cap_add` - An array Linux Capabilities (`man 7 capabilities`) to add to grant the container beyond what it normally gets.
73
+
-`cap_drop` - An array Linux Capabilities (`man 7 capabilities`) to revoke that the container normally has.
74
74
-`security_opt` - A list of string values to customize labels for MLS systems, such as SELinux.
75
-
-`shm_size` - The size of `/dev/shm`. The format is `<number><unit>`, where number must be greater than 0. Unit is optional and can be b (bytes), k (kilobytes), m(megabytes), or g (gigabytes). The default is `64m`.
76
-
-`signal` - The signal to send when using the `:kill` action. Defaults to `SIGTERM`.
77
-
-`sysctls` - A hash of sysctl settings to configure for the container.
78
-
-`timeout` - Timeout setting for container operations.
79
-
-`tmpfs` - A hash or array of tmpfs mounts to add to the container. Useful for providing a temporary filesystem without requiring privileged mode.
80
-
-`tty` - Boolean value, allocates a pseudo-TTY. Defaults to `false`.
81
-
-`user` - A string value specifying the user inside the container.
82
-
-`volumes` - An Array of paths inside the container to expose. Does the same thing as the `VOLUME` directive in a Dockerfile, but works on container creation.
83
-
-`volumes_from` - A list of volumes to inherit from another container. Specified in the form `<container name>[:<ro|rw>]`
84
-
-`volume_driver` - Driver that this container users to mount volumes.
85
-
-`working_dir` - A string specifying the working directory for commands to run in.
86
-
-`read_timeout` - May need to increase for commits or exports that are slow
87
-
-`write_timeout` - May need to increase for commits or exports that are slow
88
-
-`kill_after` - Number of seconds to wait before killing the container. Defaults to wait indefinitely; eventually will hit read_timeout limit.
89
-
-`tls` - Use TLS; implied by --tlsverify. Defaults to ENV['DOCKER_TLS'] if set
90
-
-`tls_verify` - Use TLS and verify the remote. Defaults to ENV['DOCKER_TLS_VERIFY'] if set
91
-
-`tls_ca_cert` - Trust certs signed only by this CA. Defaults to ENV['DOCKER_CERT_PATH'] if set
92
-
-`tls_client_cert` - Path to TLS certificate file for docker cli. Defaults to ENV['DOCKER_CERT_PATH'] if set
93
-
-`tls_client_key` - Path to TLS key file for docker cli. Defaults to ENV['DOCKER_CERT_PATH'] if set
94
-
-`userns_mode` - Modify the user namespace mode - Defaults to `nil`, example option: `host`
75
+
-`userns_mode` - Modify the user namespace mode. Defaults to `nil`, example option: `host`
95
76
-`pid_mode` - Set the PID (Process) Namespace mode for the container. `host`: use the host's PID namespace inside the container.
96
-
-`ipc_mode` - Set the IPC mode for the container - Defaults to `nil`, example option: `host`
97
-
-`uts_mode` - Set the UTS namespace mode for the container. The UTS namespace is for setting the hostname and the domain that is visible to running processes in that namespace. By default, all containers, including those with `--network=host`, have their own UTS namespace. The host setting will result in the container using the same UTS namespace as the host. Note that --hostname is invalid in host UTS mode.
98
-
-`ro_rootfs` - Mount the container's root filesystem as read only using the `--read-only` flag. Defaults to `false`
77
+
-`ipc_mode` - Set the IPC mode for the container. Defaults to `nil`, example option: `host`
78
+
-`uts_mode` - Set the UTS namespace mode for the container.
79
+
-`ro_rootfs` - Mount the container's root filesystem as read only. Defaults to `false`
80
+
81
+
### Logging Properties
82
+
83
+
-`log_driver` - The logging driver to use for the container. One of:
84
+
-`json-file` - Default Docker logging driver that writes JSON messages to file
85
+
-`syslog` - Syslog logging driver that writes log messages to syslog
86
+
-`journald` - Journald logging driver that writes log messages to systemd journal
87
+
-`gelf` - Graylog Extended Log Format (GELF) logging driver
0 commit comments