ocf_heartbeat_docker (7) - Linux Manuals

ocf_heartbeat_docker: Docker container resource agent.

NAME

ocf_heartbeat_docker - Docker container resource agent.

SYNOPSIS

docker [start | stop | monitor | meta-data | validate-all]

DESCRIPTION

The docker HA resource agent creates and launches a docker container based off a supplied docker image. Containers managed by this agent are both created and removed upon the agent's start and stop actions.

SUPPORTED PARAMETERS

image

The docker image to base this container off of.

(required, string, no default)

name

The name to give the created container. By default this will be that resource's instance name.

(optional, string, no default)

allow_pull

Allow the image to be pulled from the configured docker registry when the image does not exist locally. NOTE, this can drastically increase the time required to start the container if the image repository is pulled over the network.

(optional, boolean, no default)

run_opts

Add options to be appended to the 'docker run' command which is used when creating the container during the start action. This option allows users to do things such as setting a custom entry point and injecting environment variables into the newly created container. Note the '-d' option is supplied regardless of this value to force containers to run in the background.

NOTE: Do not explicitly specify the --name argument in the run_opts. This agent will set --name using either the resource's instance or the name provided in the 'name' argument of this agent.

(optional, string, no default)

run_cmd

Specifiy a command to launch within the container once it has initialized.

(optional, string, no default)

monitor_cmd

Specifiy the full path of a command to launch within the container to check the health of the container. This command must return 0 to indicate that the container is healthy. A non-zero return code will indicate that the container has failed and should be recovered.

The command is executed using nsenter. In the future 'docker exec' will be used once it is more widely supported.

(optional, string, no default)

force_kill

Kill a container immediately rather than waiting for it to gracefully shutdown

(optional, boolean, no default)

reuse

Allow the container to be reused after stopping the container. By default containers are removed after stop. With the reuse option containers will persist after the container stops.

(optional, boolean, no default)

SUPPORTED ACTIONS

This resource agent supports the following actions (operations):

start

Starts the resource. Suggested minimum timeout: 90.

stop

Stops the resource. Suggested minimum timeout: 90.

monitor

Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 30.

meta-data

Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5.

validate-all

Performs a validation of the resource configuration. Suggested minimum timeout: 30.

EXAMPLE CRM SHELL

The following is an example configuration for a docker resource using the crm(8) shell:

primitive p_docker ocf:heartbeat:docker \
  params \
    image=string \
  op monitor timeout="30" interval="30" depth="0" 

EXAMPLE PCS

The following is an example configuration for a docker resource using pcs(8)

pcs resource create p_docker ocf:heartbeat:docker \
  image=string \
  op monitor timeout="30" interval="30" depth="0" 

AUTHOR

Linux-HA contributors (see the resource agent source for information about individual authors)