Skip to content

Docker Module

ryane edited this page Aug 29, 2016 · 3 revisions

Docker Resource

Overview

The docker module allow you to manipulate the docker daemon on the host.

  • support for configuration of the docker connection (cert paths, docker host, etc.). Currently, the resources relies on support for reading the docker connection from the local environment.

docker.image

The docker.image resource allows you to ensure docker images exist on the host.

Usage

docker.image "nginx" {
  name    = "nginx"
  tag     = "latest"
  timeout = "60s"
}

Parameters

  • name: Name of the image to pull.
  • tag: Tag of the image to pull.
  • inactivity_timeout: the amount of time to wait after a period of inactivity. The timeout is reset each time new data arrives. The format is Go's duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
  • private registry support
  • ability to ensure an image does not exist
  • ability to force an update

docker.container

The docker.container resource ensures that a container with the specified configuration is running. If a container with the same name is running, converge will check to see if any of the supported properties are different. If so, it will stop and remove the existing container, and then start a new one with the new configuration.

  • is this the right thing to do or should we guard this with a force flag or something like that?
  • is there any container configuration that can be updated in place? (I don't think there is much, if any)

Usage

docker.container "nginx" {
  name  = "nginx"
  image = "nginx:latest"

  expose = [
    "80",
    "443/tcp",
  ]

  publish_all_ports = false
  ports = ["80:8000"]

  env {
    "FOO"  = "BAR"
  }

  depends = ["docker.image.nginx"]
}

Parameters

  • name: Name of the docker container.
  • image: The ID or RepoTag of the image to run.
  • entrypoint: Sets the entry point for the container.
  • command: Sets the command to run for the container.
  • working_dir: The working directory for commands to run in.
  • env: Environment variables to set in the container.
  • expose: Additional ports to expose.
  • publish_all_ports: Allocates a random host port for all of a container’s exposed ports.
  • ports: Map of exposed container ports and the host ports that they should map to. (in progress)
  • link: Add link to another container.
  • volumes: List of volumes to mount within the container. (in progress)
  • cidfile
  • pid
  • uts
  • ipc
  • dns
  • network
  • network_alias
  • add_host
  • mac_address
  • ip
  • ip6
  • link_local_ip
  • restart_policy
  • security_opt
  • cgroup_parent
  • memory
  • memory_swap
  • memory_reservation
  • kernel_memory
  • cpu_shares
  • cpu_period
  • cpuset_cpus
  • cpuset_mems
  • cpu_quota
  • blkio_weight
  • blkio_weight_device
  • device_read_bps
  • device_read_iops
  • device_write_iops
  • oom_kill_disable
  • oom_score_adj
  • memory_swappiness
  • shm_size
  • group-add
  • cap_add
  • cap_drop
  • privileged
  • device
  • log_driver
  • health-cmd
  • health-interval
  • health-retries
  • health-timeout
  • no-healthcheck
  • tmpfs
  • user

docker.network

TBD

docker.service

TBD

Clone this wiki locally