Documentation
¶
Index ¶
- Variables
- func Routes(s *server.Server) []server.Route
- type CreateRequest
- type DeleteRequest
- type DockerCollectionResponse
- type DockerCreateRequest
- type DockerCreateResponse
- type DockerDeleteResponse
- type DockerEntry
- type DockerExecRequest
- type DockerExecResponse
- type DockerExecResult
- type DockerGetResponse
- type DockerResult
- type DockerStartResponse
- type DockerStopRequest
- type DockerStopResponse
- type ExecRequest
- type GetRequest
- type ListRequest
- type StartRequest
- type StopRequest
Constants ¶
This section is empty.
Variables ¶
var Group = endpoint.Define( "docker", "The Docker containers of the host", endpoint.Area(area.Containers), endpoint.Prefix("node/{hostname}"), endpoint.Uses[dispatch.Deps](), endpoint.Tag("docker_operations", "Container", "The Docker containers of the host"), endpoint.CommandNotes("The [docker behavior](../../../../../reference/behaviors/containers/docker/docker.md) page tells where the behavior runs, what it is built on and its settings."), endpoint.Doc[types.RowStatus](dispatch.RowStatusDoc), endpoint.Get[ListRequest, DockerCollectionResponse]("list"). Handle(HandleList). ID("GetNodeDocker"). Describe("List the containers of the host"). Permission("docker:read"). Returns("Each target host's result."). Explain("Reads each container through gohai's docker collector, which runs docker ps and docker inspect. state limits the list to the running or the stopped ones. A host whose docker does not answer reports skipped. The environment of a container shows only the names of its variables: osapi never reads their values."). Example("--target web-01", "A host with a container"). Example("--target web-01 --state stopped", "Only the stopped ones"). Result("A host with a container, on one host:\n\n```ansi\n$ osapi client node docker list --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mID \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mIMAGE \x1b[0m\x1b[38;2;10;143;176mSTATE \x1b[0m\x1b[38;2;10;143;176mSUMMARY \x1b[0m\x1b[38;2;10;143;176mCREATED \x1b[0m\x1b[38;2;10;143;176mHEALTH \x1b[0m\x1b[38;2;10;143;176mPORTS \x1b[0m\x1b[38;2;10;143;176mMOUNTS \x1b[0m\x1b[38;2;10;143;176mNETWORKS \x1b[0m\x1b[38;2;10;143;176mENV NAMES\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker list --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mID \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mIMAGE \x1b[0m\x1b[38;2;10;143;176mSTATE \x1b[0m\x1b[38;2;10;143;176mSUMMARY \x1b[0m\x1b[38;2;10;143;176mCREATED \x1b[0m\x1b[38;2;10;143;176mHEALTH \x1b[0m\x1b[38;2;10;143;176mPORTS \x1b[0m\x1b[38;2;10;143;176mMOUNTS \x1b[0m\x1b[38;2;10;143;176mNETWORKS \x1b[0m\x1b[38;2;10;143;176mENV NAMES\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"created\": \"2026-11-22T10:00:00Z\",\n \"env_names\": [\n \"PATH\",\n \"APP_TOKEN\"\n ],\n \"hostname\": \"web-01\",\n \"id\": \"3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\",\n \"image\": \"alpine:3.20\",\n \"mounts\": [\n \"/srv/data:/data:ro\"\n ],\n \"name\": \"osapitest\",\n \"networks\": [\n \"bridge 172.17.0.2 via 172.17.0.1\"\n ],\n \"ports\": [\n \"0.0.0.0:8080-\\u003e80/tcp\"\n ],\n \"state\": \"running\",\n \"status\": \"ok\",\n \"summary\": \"Up 2 minutes\"\n }\n ]\n}\n```\n\nOnly the stopped ones, on one host:\n\n```ansi\n$ osapi client node docker list --target web-01 --state stopped\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;138;138;138mNone.\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker list --target _all --state stopped\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n\n 1 host: \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": []\n}\n```\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A state that is not one | `--state paused` | enum |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Get[GetRequest, DockerGetResponse]("get"). Handle(HandleGet). ID("GetNodeDockerByKey"). Describe("Get one container"). Permission("docker:read"). Returns("Each target host's result."). Explain("Reads one container by its name, its ID or the start of its ID. A container that the host does not have is not found."). Example("--target web-01 --name osapitest", "A container"). Result("A container, on one host:\n\n```ansi\n$ osapi client node docker get --target web-01 --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mID \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mIMAGE \x1b[0m\x1b[38;2;10;143;176mSTATE \x1b[0m\x1b[38;2;10;143;176mSUMMARY \x1b[0m\x1b[38;2;10;143;176mCREATED \x1b[0m\x1b[38;2;10;143;176mHEALTH \x1b[0m\x1b[38;2;10;143;176mPORTS \x1b[0m\x1b[38;2;10;143;176mMOUNTS \x1b[0m\x1b[38;2;10;143;176mNETWORKS \x1b[0m\x1b[38;2;10;143;176mENV NAMES\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker get --target _all --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mID \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mIMAGE \x1b[0m\x1b[38;2;10;143;176mSTATE \x1b[0m\x1b[38;2;10;143;176mSUMMARY \x1b[0m\x1b[38;2;10;143;176mCREATED \x1b[0m\x1b[38;2;10;143;176mHEALTH \x1b[0m\x1b[38;2;10;143;176mPORTS \x1b[0m\x1b[38;2;10;143;176mMOUNTS \x1b[0m\x1b[38;2;10;143;176mNETWORKS \x1b[0m\x1b[38;2;10;143;176mENV NAMES\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m \x1b[1mosapitest\x1b[0m alpine:3.20 \x1b[38;2;103;234;147mrunning\x1b[0m Up 2 minutes \x1b[38;2;138;138;138m2026-11-22 10:00:00\x1b[0m 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"created\": \"2026-11-22T10:00:00Z\",\n \"env_names\": [\n \"PATH\",\n \"APP_TOKEN\"\n ],\n \"hostname\": \"web-01\",\n \"id\": \"3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\",\n \"image\": \"alpine:3.20\",\n \"mounts\": [\n \"/srv/data:/data:ro\"\n ],\n \"name\": \"osapitest\",\n \"networks\": [\n \"bridge 172.17.0.2 via 172.17.0.1\"\n ],\n \"ports\": [\n \"0.0.0.0:8080-\\u003e80/tcp\"\n ],\n \"state\": \"running\",\n \"status\": \"ok\",\n \"summary\": \"Up 2 minutes\"\n }\n ]\n}\n```\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A container that the host does not have | `--name nothere` | not found |\n| A name that is an option | `--name -f` | container_id |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no docker with that name."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Post[CreateRequest, DockerCreateResponse]("create"). Handle(HandleCreate). ID("PostNodeDocker"). Describe("Create a container"). Permission("docker:write"). Returns("Each target host's result, with whether it changed."). Explain("Runs docker create, which pulls the image when the host does not have it. The environment goes on docker's standard input, not in its arguments, which each user of the host can read. auto_start starts the container once it is made. A container of the name that the host has already is not made again, and reports changed: false."). Example("--target web-01 --name osapitest --image alpine:3.20 --command sleep --command 300", "Create a container"). Example("--target web-01 --name osapitest --image alpine:3.20 --command sleep --command 300", "A container that the host has"). Result("Create a container, on one host:\n\n```ansi\n$ osapi client node docker create --target web-01 --name osapitest --image alpine:3.20 --command sleep --command 300\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker create --target _all --name osapitest --image alpine:3.20 --command sleep --command 300\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"id\": \"3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA container that the host has, on one host:\n\n```ansi\n$ osapi client node docker create --target web-01 --name osapitest --image alpine:3.20 --command sleep --command 300\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker create --target _all --name osapitest --image alpine:3.20 --command sleep --command 300\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"id\": \"3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Create a container | runs `docker create --name osapitest alpine:3.20 sleep 300` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A name that is an option | `--name -f --image alpine:3.20` | container_id |\n| No image | `--name osapitest` | required |\n| An image that is an option | `--name osapitest --image --privileged` | image_ref |\n| A hostname that is an option | `--name osapitest --image alpine:3.20 --container-hostname -x` | dns_name |\n| A hostname longer than 253 characters | `--name osapitest --image alpine:3.20 --container-hostname aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` | max |\n| A DNS server that is not an address | `--name osapitest --image alpine:3.20 --dns nameserver` | ip |\n| A port that is not host:container | `--name osapitest --image alpine:3.20 --ports 80` | port_mapping |\n| A bind mount that is not two absolute paths | `--name osapitest --image alpine:3.20 --volumes data:/data` | volume_mapping |\n| No name | `--image alpine:3.20` | required |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Delete[DeleteRequest, DockerDeleteResponse]("delete"). Handle(HandleDelete). ID("DeleteNodeDocker"). Describe("Remove a container"). Permission("docker:write"). Returns("Each target host's result, with whether it changed."). Explain("Runs docker rm -f, which also removes a container that runs: a delete leaves no container of the name. A container that the host does not have reports changed: false."). Example("--target web-01 --name osapitest", "Remove a container"). Example("--target web-01 --name osapitest", "A container that the host does not have"). Result("Remove a container, on one host:\n\n```ansi\n$ osapi client node docker delete --target web-01 --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker delete --target _all --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA container that the host does not have, on one host:\n\n```ansi\n$ osapi client node docker delete --target web-01 --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker delete --target _all --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Remove a container | runs `docker rm -f osapitest` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A name that is an option | `--name -f` | container_id |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no docker with that name."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Post[StartRequest, DockerStartResponse]("start"). Handle(HandleStart). ID("PostNodeDockerStart"). Describe("Start a container"). Permission("docker:execute"). Returns("Each target host's result, with whether it changed."). Action("start"). Explain("Runs docker start. A container that runs already reports changed: false, and one that the host does not have is not found."). Example("--target web-01 --name osapitest", "Start a container"). Example("--target web-01 --name osapitest", "A container that runs already"). Result("Start a container, on one host:\n\n```ansi\n$ osapi client node docker start --target web-01 --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker start --target _all --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA container that runs already, on one host:\n\n```ansi\n$ osapi client node docker start --target web-01 --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker start --target _all --name osapitest\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Start a container | runs `docker start osapitest` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A container that the host does not have | `--name nothere` | not found |\n| A name that is an option | `--name -f` | container_id |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no docker with that name."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Post[StopRequest, DockerStopResponse]("stop"). Handle(HandleStop). ID("PostNodeDockerStop"). Describe("Stop a container"). Permission("docker:execute"). Returns("Each target host's result, with whether it changed."). Action("stop"). Explain("Runs docker stop, which waits timeout seconds before docker kills the container, or docker's default of 10 when it is 0. A container that does not run reports changed: false."). Example("--target web-01 --name osapitest --timeout 1", "Stop a container"). Example("--target web-01 --name osapitest --timeout 1", "A container that does not run"). Result("Stop a container, on one host:\n\n```ansi\n$ osapi client node docker stop --target web-01 --name osapitest --timeout 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker stop --target _all --name osapitest --timeout 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA container that does not run, on one host:\n\n```ansi\n$ osapi client node docker stop --target web-01 --name osapitest --timeout 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker stop --target _all --name osapitest --timeout 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mID\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mosapitest\x1b[0m \x1b[38;2;138;138;138m\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"name\": \"osapitest\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Stop a container | runs `docker stop -t 1 osapitest` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A container that the host does not have | `--name nothere` | not found |\n| A name that is an option | `--name -f` | container_id |\n| A timeout longer than 300 seconds | `--name osapitest --timeout 301` | max |\n| A negative timeout | `--name osapitest --timeout -1` | min |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no docker with that name."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Post[ExecRequest, DockerExecResponse]("exec"). Handle(HandleExec). ID("PostNodeDockerExec"). Describe("Run a command in a container"). Permission("docker:exec"). Returns("Each target host's result, with whether it changed."). Action("exec"). Explain("Runs docker exec, and answers what the command wrote to standard output and to standard error, and its exit code. A command that exits with a code other than 0 is an answer, not a failure. It changes what the command changes, which osapi cannot tell, so it reports changed: true. Its permission is docker:exec, which only the admin role gets, apart from the docker:execute of start and stop. An agent with agent.command.enabled false refuses it, as it refuses a command."). Example("--target web-01 --name osapitest --command echo --command hello", "Run a command"). Result("Run a command, on one host:\n\n```ansi\n$ osapi client node docker exec --target web-01 --name osapitest --command echo --command hello\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mSTDOUT \x1b[0m\x1b[38;2;10;143;176mSTDERR \x1b[0m\x1b[38;2;10;143;176mEXIT CODE\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m hello 0\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node docker exec --target _all --name osapitest --command echo --command hello\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mSTDOUT \x1b[0m\x1b[38;2;10;143;176mSTDERR \x1b[0m\x1b[38;2;10;143;176mEXIT CODE\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m hello 0\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m hello 0\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"exit_code\": 0,\n \"hostname\": \"web-01\",\n \"status\": \"ok\",\n \"stderr\": \"\",\n \"stdout\": \"hello\\n\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Run a command | runs `docker exec osapitest echo hello` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| An empty command | `--name osapitest` | min |\n| No command | `--name osapitest` | required |\n| A name that is an option | `--name -f --command true` | container_id |\n| A working directory that is not absolute | `--name osapitest --command pwd --working-dir tmp` | startswith |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no docker with that name."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), )
Group is docker as an endpoint group, which its spec comes from.
Functions ¶
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Body DockerCreateRequest `in:"body" validate:"required"`
}
CreateRequest is the request of docker create: its target and its input.
type DeleteRequest ¶
type DeleteRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Name string `doc:"The container's name or ID" in:"path" json:"name" param:"DockerName" validate:"required,container_id"`
}
DeleteRequest is the request of docker delete: its target and its input.
type DockerCollectionResponse ¶
type DockerCollectionResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerEntry `json:"results"`
}
DockerCollectionResponse is each target host's result.
func HandleList ¶
func HandleList( ctx context.Context, d dispatch.Deps, in ListRequest, ) (DockerCollectionResponse, error)
HandleList runs docker list on the target, for the endpoint server.
type DockerCreateRequest ¶
type DockerCreateRequest struct {
Name string `doc:"The container's name" json:"name" validate:"required,container_id"`
Image string `` /* 134-byte string literal not displayed */
HostName string `doc:"The hostname inside the container" json:"container_hostname,omitempty" validate:"omitempty,dns_name,max=253"`
DNS []string `doc:"The DNS servers of the container" json:"dns,omitempty" validate:"omitempty,dive,ip"`
Command []string `doc:"The command, in place of the image's own" json:"command,omitempty" validate:"omitempty"`
Env map[string]secret.Value `doc:"The environment variables of the container" json:"env,omitempty" validate:"omitempty"`
Ports []string `doc:"The published ports, each host:container, such as 8080:80" json:"ports,omitempty" validate:"omitempty,dive,port_mapping"`
Volumes []string `` /* 133-byte string literal not displayed */
AutoStart bool `doc:"Start the container once it is created" json:"auto_start,omitempty" validate:"omitempty"`
}
DockerCreateRequest is the body of docker create.
type DockerCreateResponse ¶
type DockerCreateResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerResult `json:"results"`
}
DockerCreateResponse is each target host's result.
func HandleCreate ¶
func HandleCreate( ctx context.Context, d dispatch.Deps, in CreateRequest, ) (DockerCreateResponse, error)
HandleCreate runs docker create on the target, for the endpoint server.
type DockerDeleteResponse ¶
type DockerDeleteResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerResult `json:"results"`
}
DockerDeleteResponse is each target host's result.
func HandleDelete ¶
func HandleDelete( ctx context.Context, d dispatch.Deps, in DeleteRequest, ) (DockerDeleteResponse, error)
HandleDelete runs docker delete on the target, for the endpoint server.
type DockerEntry ¶
type DockerEntry struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
ID *string `doc:"The container's full ID" json:"id,omitempty"`
Name *string `doc:"The container's name" json:"name,omitempty"`
Image *string `doc:"The image it runs" json:"image,omitempty"`
State *string `doc:"running, exited, created, paused or restarting" json:"state,omitempty"`
Summary *string `doc:"What docker says of its state, such as Up 2 minutes" json:"summary,omitempty"`
Created *string `doc:"When it was created, RFC 3339" json:"created,omitempty"`
Health *string `doc:"The state of its health check: healthy, unhealthy or starting; empty without one" json:"health,omitempty"`
Ports *[]string `doc:"The published ports, host:port->container port" json:"ports,omitempty"`
Mounts *[]string `doc:"The mounts, source:destination, with :ro when read only" json:"mounts,omitempty"`
Networks *[]string `doc:"The networks, with the container's address and gateway on each" json:"networks,omitempty"`
EnvNames *[]string `doc:"The names of its environment variables; osapi never reads their values" json:"env_names,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
DockerEntry is the result of docker on one host.
type DockerExecRequest ¶
type DockerExecRequest struct {
Command []string `doc:"The command and its arguments" json:"command" validate:"required,min=1"`
Env map[string]secret.Value `doc:"Environment variables for the command" json:"env,omitempty" validate:"omitempty"`
WorkingDir string `doc:"The directory the command runs in" json:"working_dir,omitempty" validate:"omitempty,startswith=/"`
}
DockerExecRequest is the body of docker exec.
type DockerExecResponse ¶
type DockerExecResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerExecResult `json:"results"`
}
DockerExecResponse is each target host's result.
func HandleExec ¶
func HandleExec( ctx context.Context, d dispatch.Deps, in ExecRequest, ) (DockerExecResponse, error)
HandleExec runs docker exec on the target, for the endpoint server.
type DockerExecResult ¶
type DockerExecResult struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Stdout *string `doc:"What the command wrote to standard output" json:"stdout,omitempty"`
Stderr *string `doc:"What the command wrote to standard error" json:"stderr,omitempty"`
ExitCode *int `doc:"The command's exit code" json:"exit_code,omitempty"`
Changed *bool `doc:"Always true: osapi cannot tell what the command changed" json:"changed,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
DockerExecResult is the result of docker on one host.
type DockerGetResponse ¶
type DockerGetResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerEntry `json:"results"`
}
DockerGetResponse is each target host's result.
func HandleGet ¶
func HandleGet( ctx context.Context, d dispatch.Deps, in GetRequest, ) (DockerGetResponse, error)
HandleGet runs docker get on the target, for the endpoint server.
type DockerResult ¶
type DockerResult struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Name *string `doc:"The container" json:"name,omitempty"`
ID *string `doc:"The container's full ID, for create" json:"id,omitempty"`
Changed *bool `doc:"Whether the host changed" json:"changed,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
DockerResult is the result of docker on one host.
type DockerStartResponse ¶
type DockerStartResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerResult `json:"results"`
}
DockerStartResponse is each target host's result.
func HandleStart ¶
func HandleStart( ctx context.Context, d dispatch.Deps, in StartRequest, ) (DockerStartResponse, error)
HandleStart runs docker start on the target, for the endpoint server.
type DockerStopRequest ¶
type DockerStopRequest struct {
Timeout int `` /* 129-byte string literal not displayed */
}
DockerStopRequest is the body of docker stop.
type DockerStopResponse ¶
type DockerStopResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []DockerResult `json:"results"`
}
DockerStopResponse is each target host's result.
func HandleStop ¶
func HandleStop( ctx context.Context, d dispatch.Deps, in StopRequest, ) (DockerStopResponse, error)
HandleStop runs docker stop on the target, for the endpoint server.
type ExecRequest ¶
type ExecRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Name string `doc:"The container's name or ID" in:"path" json:"name" param:"DockerName" validate:"required,container_id"`
Body DockerExecRequest `in:"body" validate:"required"`
}
ExecRequest is the request of docker exec: its target and its input.
type GetRequest ¶
type GetRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Name string `doc:"The container's name or ID" in:"path" json:"name" param:"DockerName" validate:"required,container_id"`
}
GetRequest is the request of docker get: its target and its input.
type ListRequest ¶
type ListRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
State types.ContainerState `` /* 137-byte string literal not displayed */
}
ListRequest is the request of docker list: its target and its input.
type StartRequest ¶
type StartRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Name string `doc:"The container's name or ID" in:"path" json:"name" param:"DockerName" validate:"required,container_id"`
}
StartRequest is the request of docker start: its target and its input.
type StopRequest ¶
type StopRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Name string `doc:"The container's name or ID" in:"path" json:"name" param:"DockerName" validate:"required,container_id"`
Body DockerStopRequest `in:"body" validate:"required"`
}
StopRequest is the request of docker stop: its target and its input.