Search or ask Docker

Delete unused networks

POST /networks/prune — Docker Engine API 1.57.

View Markdown
POST/networks/prune

Connection and access

API connection and authentication guidance

/v1.57

No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.

Parameters

filters query

Filters to process on the prune list, encoded as JSON (a map[string][]string).

Available filters:

  • until=<timestamp> Prune networks created before this timestamp. The <timestamp> can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed relative to the daemon machine’s time.
  • label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>) Prune networks with (or without, in case label!=... is used) the specified labels.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Response 200

No error

application/json

Type: object

NetworksDeleted

Type: array

Networks that were deleted
Array item

Type: string

All schema constraints and annotations
{
  "type": "string"
}
All schema constraints and annotations
{
  "description": "Networks that were deleted",
  "items": {
    "type": "string"
  },
  "type": "array"
}
All schema constraints and annotations
{
  "properties": {
    "NetworksDeleted": {
      "description": "Networks that were deleted",
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "title": "NetworkPruneResponse",
  "type": "object"
}

Response 500

Server error

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Referenced schemas

#/components/schemas/ErrorResponse

Complete operation contract
{
  "operationId": "NetworkPrune",
  "parameters": [
    {
      "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=\u003ctimestamp\u003e` Prune networks created before this timestamp. The `\u003ctimestamp\u003e` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=\u003ckey\u003e`, `label=\u003ckey\u003e=\u003cvalue\u003e`, `label!=\u003ckey\u003e`, or `label!=\u003ckey\u003e=\u003cvalue\u003e`) Prune networks with (or without, in case `label!=...` is used) the specified labels.\n",
      "in": "query",
      "name": "filters",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "NetworksDeleted": {
                "description": "Networks that were deleted",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "title": "NetworkPruneResponse",
            "type": "object"
          }
        }
      },
      "description": "No error"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Server error"
    }
  },
  "summary": "Delete unused networks",
  "tags": [
    "Network"
  ]
}