# Remove an image


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`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](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request DELETE \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  'http://localhost/v1.57/images/<NAME>'
```



## Parameters

### name

Location: path. Required: yes.

Image name or ID

```json
{
  "description": "Image name or ID",
  "in": "path",
  "name": "name",
  "pointer": "/paths/~1images~1{name}/delete/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### force

Location: query. Required: no.

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

```json
{
  "description": "Remove the image even if it is being used by stopped containers or has other tags",
  "in": "query",
  "name": "force",
  "pointer": "/paths/~1images~1{name}/delete/parameters/1",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

### noprune

Location: query. Required: no.

Do not delete untagged parent images

```json
{
  "description": "Do not delete untagged parent images",
  "in": "query",
  "name": "noprune",
  "pointer": "/paths/~1images~1{name}/delete/parameters/2",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

### platforms

Location: query. Required: no.

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


```json
{
  "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",
  "pointer": "/paths/~1images~1{name}/delete/parameters/3",
  "schema": {
    "items": {
      "type": "string"
    },
    "type": "array"
  },
  "style": "form"
}
```

## Request and responses

### Response 200 application/json

The image was deleted successfully


Schema:

```json
{
  "items": {
    "$ref": "#/components/schemas/ImageDeleteResponseItem"
  },
  "type": "array"
}
```









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


### Response 404 application/json

No such image


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 409 application/json

Conflict


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 500 application/json

Server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "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"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)

- [#/components/schemas/ImageDeleteResponseItem](/reference/api/engine/version/v1.57/schemas/ImageDeleteResponseItem/)




