Annotated documentation for DockerInc::Docker::Container
This is a companion to my article on the Docker plugin for Heat.
DockerInc::Docker::Container⌗
Properties⌗
cmd
: ListCommand to run after spawning the container.
Optional property.
Example:
cmd: [ 'thttpd', '-C', '/etc/thttpd.conf', '-D', '-c', '*.cgi']
dns
: ListSet custom DNS servers.
Example:
dns: - 8.8.8.8 - 8.8.4.4
docker_endopint
: StringDocker daemon endpoint. By default the local Docker daemon will be used.
Example:
docker_endpoint: tcp://192.168.1.100:2375
env
: StringSet environment variables.
Example:
env: - MYSQL_ROOT_PASSWORD=secret - "ANOTHER_VARIABLE=something long with spaces"
hostname
: StringHostname of the container.
Example:
hostname: mywebserver
image
: StringImage name to boot.
Example:
image: mysql
links
: MappingLinks to other containers.
Example:
links: name_in_this_container: name_of_that_container
memory
: NumberMemory limit in bytes.
Example:
# 512 MB memory: 536870912
name
: StringName of the container.
Example:
name: dbserver
open_stdin
: BooleanTrue to open
stdin
.Example:
open_stdin: true
port_bindings
: MapTCP/UDP port bindings.
Example:
# bind port 8080 in the container to port 80 on the host port_bindings: 8080: 80
port_specs
: ListList of TCP/UDP ports exposed by the container.
Example:
port_specs: - 80 - 53/udp
privileged
: BooleanEnable extended privileges.
Example:
privileged: true
stdin_once
: BooleanIf
true
, closestdin
after the one attached client disconnects.Example:
stdin_once: true
tty
: BooleanAllocate a pseudo-tty if
true
.Example:
tty: true
user
: StringUsername or UID for running the container.
Example:
username: apache
volumes
: MapCreate a bind mount.
Example:
volumes: /var/tmp/data_on_host: /srv/data_in_container
volumes_from
: StringThis option is broken in the current version of the Docker plugin.
Attributes⌗
info
: MapInformation about the container.
Example:
info: value: {get_attr: ["docker_dbserver", "info"]}
Output:
{ "HostsPath": "/var/lib/docker/containers/d6d84d1bbf2984fa3e04cea36c8d10d27d318b6d96b57c41fca2cbc1da23bf71/hosts", "Created": "2014-09-01T14:21:02.7577874Z", "Image": "a950533b3019d8f6dfdcb8fdc42ef810b930356619b3e4786d4f2acec514238d", "Args": [ "mysqld", "--datadir=/var/lib/mysql", "--user=mysql" ], "Driver": "devicemapper", "HostConfig": { "CapDrop": null, "PortBindings": { "3306/tcp": [ { "HostPort": "3306", "HostIp": "" } ] }, "NetworkMode": "", . . .
logs
: StringLogs from the container.
Example:
logs: value: {get_attr: ["docker_dbserver", "logs"]}
logs_head
: StringMost recent log line from the container.
Example:
logs: value: {get_attr: ["docker_dbserver", "logs_head"]}
Output:
"2014-09-01 14:21:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details)."
network_gateway
: StringIP address of the network gateway for the container.
Example:
network_gateway: value: {get_attr: ["docker_dbserver", "network_gateway"]}
Output:
"172.17.42.1"
network_info
: MapInformation about the network configuration of the container.
Example:
network_info: value: {get_attr: ["docker_dbserver", "network_info"]}
Output:
{ "Bridge": "docker0", "TcpPorts": "3306", "PortMapping": null, "IPPrefixLen": 16, "UdpPorts": "", "IPAddress": "172.17.0.10", "Gateway": "172.17.42.1", "Ports": { "3306/tcp": [ { "HostPort": "3306", "HostIp": "0.0.0.0" } ] } }
network_ip
: StringIP address assigned to the container.
Example:
network_ip: value: {get_attr: ["docker_dbserver", "network_ip"]}
Output:
"172.17.0.10"
network_tcp_ports
: StringA comma delimited list of TCP ports exposed by the container.
Example:
network_tcp_ports: value: {get_attr: ["docker_dbserver", "network_tcp_ports"]}
Output:
"8443,8080"
network_udp_ports
: StringA comma delimited list of TCP ports exposed by the container.
Example:
network_udp_ports: value: {get_attr: ["docker_dbserver", "network_udp_ports"]}
Output:
"8443,8080"