← All procedures

docker.prune

Remove unused containers, images, volumes, networks or build cache. It needs confirm: true

CLI
Package
@procedures/docker · README
Path
["docker","prune"]
CLI
mark docker prune --confirm <boolean>
As data
{"$proc":["docker","prune"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/docker/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["docker","prune"], { confirm: true });
console.log(JSON.stringify(result));

From the command line

$ mark docker prune --confirm <boolean>

As data, in a program

{ "$proc": ["docker", "prune"], "input": { "confirm": true } }

Input

FieldTypeRequiredDefaultDescription
kind"system" | "container" | "image" | "volume" | "network" | "builder"noWhat to remove. system: the stopped containers, the unused networks, the dangling images and the build cache (default: system)
allbooleannoAlso the unused images that have a name (image, system, builder), or the named volumes (volume)
volumesbooleannoWith the kind system: also the unused volumes. Their data is lost
filterstringnoA filter of docker, for example label=app or dangling=true
confirmbooleanyesMust be true: the removed objects and their data are lost
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
exitCodenumberyesThe exit code of docker (0 is success)
stdoutstringyesThe standard output of docker
stderrstringyesThe standard error of docker, or the error message when docker did not start
successbooleanyesTrue when the exit code is 0
durationnumberyesThe time of the command, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "kind": {
        "description": "What to remove. system: the stopped containers, the unused networks, the dangling images and the build cache (default: system)",
        "type": "string",
        "enum": [
          "system",
          "container",
          "image",
          "volume",
          "network",
          "builder"
        ]
      },
      "all": {
        "description": "Also the unused images that have a name (image, system, builder), or the named volumes (volume)",
        "type": "boolean"
      },
      "volumes": {
        "description": "With the kind system: also the unused volumes. Their data is lost",
        "type": "boolean"
      },
      "filter": {
        "description": "A filter of docker, for example label=app or dangling=true",
        "type": "string"
      },
      "confirm": {
        "type": "boolean",
        "const": true,
        "description": "Must be true: the removed objects and their data are lost"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "confirm"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exitCode": {
        "type": "number",
        "description": "The exit code of docker (0 is success)"
      },
      "stdout": {
        "type": "string",
        "description": "The standard output of docker"
      },
      "stderr": {
        "type": "string",
        "description": "The standard error of docker, or the error message when docker did not start"
      },
      "success": {
        "type": "boolean",
        "description": "True when the exit code is 0"
      },
      "duration": {
        "type": "number",
        "description": "The time of the command, in milliseconds"
      }
    },
    "required": [
      "exitCode",
      "stdout",
      "stderr",
      "success",
      "duration"
    ],
    "additionalProperties": {}
  }
}