Skip to main content

Docker

The Docker tools work on containers. They need the docker command on the machine they run on.

docker_list​

read

Lists Docker containers, including stopped ones, so a name in the list is not a name that is running. Read state.

Arguments​

ArgumentTypeDescription
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
idstringShort container ID (12 characters).
namestringContainer name.
imagestringImage the container was created from.
statusstringStatus for a person: Running · 14m for a running container and Stopped · 20m ago for an exited one. A container with a health check appends its result, such as Running · 14m(healthy). Spaces in Docker's duration text are removed and its unit words are shortened, so About a minute appears as Aboutam. Other states keep the text Docker prints.
statestringDocker state, such as running, exited or created.
portsstringPublished and exposed ports as Docker prints them. An empty string when there are none.
Examples

The response is an array with one entry per container, shortened here to two of the example containers:

[
{
"id": "4fbc5bbd2114",
"name": "vaultwarden",
"image": "app:2",
"status": "Running · 14m",
"state": "running",
"ports": "3001/tcp, 0.0.0.0:8101->80/tcp, [::]:8101->80/tcp"
},
{
"id": "005f87f08aa4",
"name": "extra",
"image": "node:lts-alpine",
"status": "Stopped · 20m ago",
"state": "exited",
"ports": ""
}
]

docker_stats​

read

Returns one resource reading for each running container: CPU, memory, network, block I/O and process count. Values are strings in the units Docker prints.

Arguments​

ArgumentTypeDescription
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
idstringShort container ID.
namestringContainer name.
cpu_percentstringCPU use, such as 0.00%.
mem_usagestringMemory in use and the limit, such as 11.6MiB / 7.755GiB.
mem_percentstringMemory use against the limit, such as 0.15%.
net_iostringNetwork bytes received and sent, such as 2.23kB / 606B.
block_iostringBlock device bytes read and written, such as 0B / 0B.
pidsstringNumber of processes in the container, as a string.
Examples

The response is an array with one entry per running container, shortened here to one:

[
{
"id": "4fbc5bbd2114",
"name": "vaultwarden",
"cpu_percent": "0.00%",
"mem_usage": "11.6MiB / 7.755GiB",
"mem_percent": "0.15%",
"net_io": "2.23kB / 606B",
"block_io": "0B / 0B",
"pids": "7"
}
]

docker_logs​

read

Returns the last lines of a container's log, standard output and standard error combined. It returns the lines that exist and does not follow the stream. Logs can contain credentials that the container printed.

Arguments​

ArgumentTypeDescription
name requiredstringThe container name. It may contain letters, digits, -, _ and ., must not start with -, and can be up to 128 characters. Any other name returns invalid container name: <name>.
linesintegerNumber of lines from the end of the log. Digits only: a negative number or text returns invalid line count: <value> (must be a positive integer). 0 returns an empty log. Default: 50.
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
containerstringThe container name you passed.
linesstringThe line count that was applied, as a string.
logsstringThe log text, with lines separated by \n.
Examples

Read the last three lines of a container that logged its startup three times:

Arguments:

{
"name": "web",
"lines": 3
}

Response:

{
"container": "web",
"lines": "3",
"logs": "listening on 18102\nlistening on 18102\nlistening on 18102"
}

A name that fails the rule returns an error without calling Docker:

Arguments:

{
"name": "-rf"
}

Response:

invalid container name: -rf

docker_top​

read

Lists the processes running inside a container, read from the host. It runs no command in the container and opens no terminal.

Arguments​

ArgumentTypeDescription
name requiredstringThe container name. It may contain letters, digits, -, _ and ., must not start with -, and can be up to 128 characters. Any other name returns invalid container name: <name>.
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
containerstringThe container name you passed.
processesarray of objectsOne entry per process.
processes.pidstringProcess ID on the host, as a string.
processes.userstringUser that owns the process.
processes.commandstringThe kernel's process name (ps comm), at most 15 characters, so a Node.js process shows MainThread. It is the same name the processes tool reports. Nothing from the command line. A server older than 1.4.0 reached with server is reduced to the first word of each line.
skippedinteger, optionalNumber of output rows that could not be parsed. Left out when all rows were read.
Examples

Arguments:

{
"name": "web"
}

Response:

{
"container": "web",
"processes": [
{
"pid": "42301",
"user": "root",
"command": "sleep"
}
]
}

docker_inspect​

read

Summarizes a container's image, state, restart policy, ports, mounts, networks and health. The output has no field for environment variables, so their values never appear.

Arguments​

ArgumentTypeDescription
name requiredstringThe container name. It may contain letters, digits, -, _ and ., must not start with -, and can be up to 128 characters. Any other name returns invalid container name: <name>.
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
namestringContainer name.
imagestringImage the container runs.
statusstringDocker state, such as running or exited.
uptimestring, optionalTime since the container started, such as up 14m. Left out when the container is not running.
restart_policystringDocker restart policy. no when none is set.
restart_countintegerNumber of times Docker has restarted the container.
portsarray of objectsPublished and exposed ports.
ports.containerstringContainer port and protocol, such as 80/tcp.
ports.hoststring, optionalHost address and port, such as 0.0.0.0:8101. Left out when the port is exposed but not published.
mountsarray of objectsVolumes and bind mounts.
mounts.sourcestringPath on the host.
mounts.destinationstringPath in the container.
mounts.modestringDocker's mode for the mount, such as rw, ro or z. When Docker reports none, rw or ro from the mount's access.
networksarray of objectsNetworks the container is attached to.
networks.namestringNetwork name.
networks.ipstring, optionalThe container's address in the network. Left out when none is assigned.
healthstring, optionalDocker health check status, such as healthy. Left out when the container has no health check.
Examples

Arguments:

{
"name": "vaultwarden"
}

Response:

{
"name": "vaultwarden",
"image": "app:2",
"status": "running",
"uptime": "up 14m",
"restart_policy": "no",
"restart_count": 0,
"ports": [
{
"container": "3001/tcp"
},
{
"host": "0.0.0.0:8101",
"container": "80/tcp"
},
{
"host": "[::]:8101",
"container": "80/tcp"
}
],
"mounts": [
{
"source": "/var/lib/docker/volumes/data/_data",
"destination": "/data",
"mode": "rw"
}
],
"networks": [
{
"name": "homelab_default",
"ip": "172.27.0.2"
}
]
}

docker_restart​

write

Restarts a container by name. The container goes down and comes back. The result says the restart command succeeded, not that the app inside is serving again. Read the logs first if you don't know why it needs a restart.

Arguments​

ArgumentTypeDescription
name requiredstringThe container name. It may contain letters, digits, -, _ and ., must not start with -, and can be up to 128 characters. Any other name returns invalid container name: <name>.
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
actionstringAlways restart.
containerstringThe container name you passed.
statusstringok when Docker restarted the container.
Examples

Arguments:

{
"name": "web"
}

Response:

{
"action": "restart",
"container": "web",
"status": "ok"
}

Without name, the call returns an error:

missing required parameter: name

docker_stop​

destructive

Stops a container by name. homebutler has no tool that starts a container again, so the operator brings it back.

Arguments​

ArgumentTypeDescription
name requiredstringThe container name. It may contain letters, digits, -, _ and ., must not start with -, and can be up to 128 characters. Any other name returns invalid container name: <name>.
serverstringServer from your config to run on. See Run a tool on another server.

Response​

FieldTypeMeaning
actionstringAlways stop.
containerstringThe container name you passed.
statusstringok when Docker stopped the container.
Examples

Arguments:

{
"name": "extra"
}

Response:

{
"action": "stop",
"container": "extra",
"status": "ok"
}

A name that no container has returns Docker's message:

Arguments:

{
"name": "missing"
}

Response:

failed to stop missing: Error response from daemon: No such container: missing