Methods for building complex docker types. This is most objects more complicated than R's atomic types. Most functions will indicate if they require one of these objects in their help. None of these functions do anything interesting in their own regard - they just validate inputs.

Details

The functions here will all depend on the API versions - some of the most fluid parts of the docker API are the different options that are supported via things like host_config.

These functions are needed because stevedore aims to be a fairly direct wrapping around the docker API. For most of the single host methods the types here are not really used (with the notable exception of host_config which is used by $container$create and $container$update). But for the swarm endpoints the function definitions would be impossibly complex if we did not reflect the types. So rather than one function call with a hundred arguments, we can build up the required types.

Below is reference documentation for all methods for version '1.29' of the docker API - other versions are available. This documentation is automatically generated from docker's API schema, and so inaccuracies may exist between it and stevedore's interface (especially references to JSON objects). Please report any documentation that might be improved at https://github.com/richfitz/stevedore/issues

Methods

container_spec

container_spec

Usage:

  container_spec(image = NULL, labels = NULL, command = NULL,
      args = NULL, hostname = NULL, env = NULL, dir = NULL,
      user = NULL, groups = NULL, tty = NULL,
      open_stdin = NULL, read_only = NULL, mounts = NULL,
      stop_signal = NULL, stop_grace_period = NULL,
      health_check = NULL, hosts = NULL, dns_config = NULL,
      secrets = NULL)

Arguments:

  • image: The image name to use for the container.

  • labels: User-defined key/value data.

  • command: The command to be run in the image.

  • args: Arguments to the command.

  • hostname: The hostname to use for the container, as a valid RFC 1123 hostname.

  • env: A list of environment variables in the form VAR=value.

  • dir: The working directory for commands to run in.

  • user: The user inside the container.

  • groups: A list of additional groups that the container process will run as.

  • tty: Whether a pseudo-TTY should be allocated.

  • open_stdin: Open stdin

  • read_only: Mount the container's root filesystem as read only.

  • mounts: Specification for mounts to be added to containers created as part of the service.

  • stop_signal: Signal to stop the container.

  • stop_grace_period: Amount of time to wait for the container to terminate before forcefully killing it.

  • health_check: A test to perform to check that the container is healthy. Construct with $types$health_config()

  • hosts: A list of hostnames/IP mappings to add to the container's /etc/hosts file. The format of extra hosts on swarmkit is specified in: http://man7.org/linux/man-pages/man5/hosts.5.html IP_address canonical_hostname [aliases...]

  • dns_config: Specification for DNS related configurations in resolver configuration file (resolv.conf). Construct with $types$dns_config()

  • secrets: Secrets contains references to zero or more secrets that will be exposed to the service.

dns_config

Specification for DNS related configurations in resolver configuration file (resolv.conf).

Usage:

  dns_config(nameservers = NULL, search = NULL,
      options = NULL)

Arguments:

  • nameservers: The IP addresses of the name servers.

  • search: A search list for host-name lookup.

  • options: A list of internal resolver variables to be modified (e.g., debug, ndots:3, etc.).

health_config

A test to perform to check that the container is healthy.

Usage:

  health_config(test = NULL, interval = NULL, timeout = NULL,
      retries = NULL, start_period = NULL)

Arguments:

  • test: The test to perform. Possible values are:

    • [] inherit healthcheck from image or parent image

    • ["NONE"] disable healthcheck

    • ["CMD", args...] exec arguments directly

    • ["CMD-SHELL", command] run command with system's default shell

  • interval: The time to wait between checks in nanoseconds. It should be 0 or not less than 1000000000(1s). 0 means inherit.

  • timeout: The time to wait before considering the check to have hung. It should be 0 or not less than 1000000000(1s). 0 means inherit.

  • retries: The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.

  • start_period: Start period for the container to initialize before starting health-retries countdown in nanoseconds. 0 means inherit.

help

Display help for this object

Usage:

  help(help_type = getOption("help_type"))

Arguments:

  • help_type: Passed to utils::help, can be one of "text", "html" or "pdf" (or an abbreviation). By default it uses the value getOption("help_type") and should follow the same behaviour as other R help (e.g., using "?")

mount

mount

Usage:

  mount(target = NULL, source = NULL, type = NULL,
      read_only = NULL, consistency = NULL,
      bind_options = NULL, volume_options = NULL,
      tmpfs_options = NULL)

Arguments:

  • target: Container path.

  • source: Mount source (e.g. a volume name, a host path).

  • type: The mount type. Available types:

    • bind Mounts a file or directory from the host into the container. Must exist prior to creating the container.

    • volume Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are not removed when the container is removed.

    • tmpfs Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.

  • read_only: Whether the mount should be read-only.

  • consistency: The consistency requirement for the mount: default, consistent, cached, or delegated.

  • bind_options: Optional configuration for the bind type.

  • volume_options: Optional configuration for the volume type.

  • tmpfs_options: Optional configuration for the tmpfs type.

task_placement

task_placement

Usage:

  task_placement(constraints = NULL, preferences = NULL)

Arguments:

  • constraints: An array of constraints.

  • preferences: Preferences provide a way to make the scheduler aware of factors such as topology. They are provided in order from highest to lowest precedence.

task_resources

Resource requirements which apply to each individual container created as part of the service.

Usage:

  task_resources(limits = NULL, reservation = NULL)

Arguments:

  • limits: Define resources limits.

  • reservation: Define resources reservation.

task_restart_policy

Specification for the restart policy which applies to containers created as part of this service.

Usage:

  task_restart_policy(condition = NULL, delay = NULL,
      max_attempts = NULL, window = NULL)

Arguments:

  • condition: Condition for restart.

  • delay: Delay between restart attempts.

  • max_attempts: Maximum attempts to restart a given container before giving up (default value is 0, which is ignored).

  • window: Windows is the time window used to evaluate the restart policy (default value is 0, which is unbounded).

task_spec

User modifiable task configuration.

Usage:

  task_spec(container_spec = NULL, resources = NULL,
      restart_policy = NULL, placement = NULL,
      force_update = NULL, networks = NULL, log_driver = NULL)

Arguments:

  • container_spec: Construct with $types$container_spec()

  • resources: Resource requirements which apply to each individual container created as part of the service. Construct with $types$task_resources()

  • restart_policy: Specification for the restart policy which applies to containers created as part of this service. Construct with $types$task_restart_policy()

  • placement: Construct with $types$task_placement()

  • force_update: A counter that triggers an update even if no relevant parameters have been changed.

  • networks: NA

  • log_driver: Specifies the log driver to use for tasks created from this spec. If not present, the default one for the swarm will be used, finally falling back to the engine default if not specified.