Search or ask Docker

Remove an image

DELETE /images/{name} — Docker Engine API 1.57.

View Markdown
DELETE/images/{name}

Remove an image, along with any untagged parent images that were referenced by that image.

Images can't be removed if they have descendant images, are being used by a running container or are being used by a build.

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

name path Required

Image name or ID

Type: string

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

force query

Remove the image even if it is being used by stopped containers or has other tags

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

noprune query

Do not delete untagged parent images

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

platforms query

Select platform-specific content to delete. Repeat the parameter to select multiple platforms. Each platform is a OCI platform encoded as a JSON string.

Type: array

Array item

Type: string

All schema constraints and annotations
{
  "type": "string"
}
All schema constraints and annotations
{
  "items": {
    "type": "string"
  },
  "type": "array"
}

Serialization: form

Request and responses

Response 200

The image was deleted successfully

application/json

Type: array

Array item

Schema: ImageDeleteResponseItem

All schema constraints and annotations
{
  "items": {
    "$ref": "#/components/schemas/ImageDeleteResponseItem"
  },
  "type": "array"
}

Example

[
  {
    "Untagged": "3e2f21a89f"
  },
  {
    "Deleted": "3e2f21a89f"
  },
  {
    "Deleted": "53b4f83ac9"
  }
]

Response 404

No such image

application/json

Schema: ErrorResponse

Schema example

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

Response 409

Conflict

application/json

Schema: ErrorResponse

Schema example

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

Response 500

Server error

application/json

Schema: ErrorResponse

Schema example

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

Referenced schemas

#/components/schemas/ErrorResponse

#/components/schemas/ImageDeleteResponseItem

Complete operation contract
{
  "description": "Remove an image, along with any untagged parent images that were\nreferenced by that image.\n\nImages can't be removed if they have descendant images, are being\nused by a running container or are being used by a build.\n",
  "operationId": "ImageDelete",
  "parameters": [
    {
      "description": "Image name or ID",
      "in": "path",
      "name": "name",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Remove the image even if it is being used by stopped containers or has other tags",
      "in": "query",
      "name": "force",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Do not delete untagged parent images",
      "in": "query",
      "name": "noprune",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Select platform-specific content to delete.\nRepeat the parameter to select multiple platforms.\nEach platform is a OCI platform encoded as a JSON string.\n",
      "explode": true,
      "in": "query",
      "name": "platforms",
      "schema": {
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "style": "form"
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "example": [
            {
              "Untagged": "3e2f21a89f"
            },
            {
              "Deleted": "3e2f21a89f"
            },
            {
              "Deleted": "53b4f83ac9"
            }
          ],
          "schema": {
            "items": {
              "$ref": "#/components/schemas/ImageDeleteResponseItem"
            },
            "type": "array"
          }
        }
      },
      "description": "The image was deleted successfully"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "No such image"
    },
    "409": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Conflict"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Server error"
    }
  },
  "summary": "Remove an image",
  "tags": [
    "Image"
  ]
}