OCF_HEARTBEAT_DOCKER(7)
π OCF_HEARTBEAT_DOCKER(7) π
okay so bestie, this is a page from the OCF resource agents manual set β the ocf_heartbeat_docker one β and it's literally all about running Docker containers as HA resources. buckle up π
β¨ NAME β¨
ocf_heartbeat_docker β the Docker container resource agent. that's it, that's the vibe π
πΈ SYNOPSIS πΈ
docker [start | stop | monitor | meta-data | validate-all]
π¦ DESCRIPTION π¦
So the docker HA resource agent literally creates and launches a docker container based off a docker image you hand it. The containers this agent manages are both created and removed on the agent's start and stop actions β like, it's not just nudging an existing thing, it's doing the whole lifecycle. periodt β¨
π SUPPORTED PARAMETERS π
imageβ the docker image you're basing this container off of. this one's required, it's a string, and there's no default. you gotta give it something, bestie π«Άnameβ the name to give the created container. by default this will be that resource's instance name. (optional, string, no default)allow_pullβ lets the image be pulled from the configured docker registry when the image doesn't exist locally. β οΈ NOTE: this can drastically increase the time required to start the container if the image repository is pulled over the network. like, drastically drastically. (optional, boolean, no default) π₯run_optsβ adds options that get appended to thedocker runcommand, which is what's used when creating the container during the start action. this one's iconic because it lets users do stuff like setting a custom entry point and injecting environment variables into the newly created container. note that the-doption is supplied regardless of this value, to force containers to run in the background. π
NOTE: do not explicitly specify the--nameargument in therun_opts. this agent will set--nameusing either the resource's instance or the name provided in thenameargument of this agent.
(optional, string, no default)
run_cmdβ specify a command to launch within the container once it has initialized. (optional, string, no default) πΈmount_pointsβ a comma separated list of directories that the container is expecting to use. the agent will ensure they exist by runningmkdir -p. (optional, string, no default) πmonitor_cmdβ specify 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. π
If docker exec is supported, it is used to execute the command. If not, nsenter is used.
Note: using this method for monitoring processes inside a container is not recommended, as containerd tries to track processes running inside the container and does not deal well with many short-lived processes being spawned. ensure that your container monitors its own processes and terminates on fatal error rather than invoking a command from the outside. pls. for me. π
(optional, string, no default)
force_killβ kill a container immediately rather than waiting for it to gracefully shutdown. no chill mode, just π (optional, boolean, no default)reuseβ allow the container to be reused once it's stopped. by default, containers get removed once they are stopped. enable this option to have the particular one persist when this happens. (optional, boolean, default0)query_docker_healthβ query the builtin healthcheck of docker (v1.12+) to determine health of the container. if left empty or set to false it will not be used. β¨
The healthcheck itself has to be configured within docker, e.g. via HEALTHCHECK in Dockerfile. this option just queries in what condition docker considers the container to be and lets ocf do its thing accordingly. π§
Note that the time a container is in "starting" state counts against the monitor timeout. β³
This is an additional check besides the standard check for the container to be running, and the optional monitor_cmd check. it doesn't disable or override them, so all of them (if used) have to come back healthy for the container to be considered healthy. no partial credit, bestie π
(optional, boolean, no default)
β SUPPORTED ACTIONS β
This resource agent supports the following actions (operations):
startβ starts the resource. suggested minimum timeout:90s.stopβ stops the resource. suggested minimum timeout:90s.monitorβ performs a detailed status check. suggested minimum timeout:30s. suggested interval:30s.meta-dataβ retrieves resource agent metadata (internal use only). suggested minimum timeout:5s.validate-allβ performs a validation of the resource configuration. suggested minimum timeout:30s.
π 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="30s" interval="30s" 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="30s" interval="30s" OCF_CHECK_LEVEL="0"
π¦ SEE ALSO π¦
http://clusterlabs.org/ β go look, iykyk π
π AUTHOR π
ClusterLabs contributors (see the resource agent source for information about individual authors) π«Ά
okay that's the whole page!! mwah π this build is resource-agents UNKNOWN and the date on it is 10/01/2026 β noted, dated, slayed. go forth and containerize, bestie ππ
π¦ where this page comes from
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms