📜  docker remove image by id (1)

📅  最后修改于: 2023-12-03 14:40:49.581000             🧑  作者: Mango

Docker Remove Image by ID

To remove a Docker image by its ID, you can use the following command:

docker rmi <image-id>

Replace <image-id> with the ID of the image you want to remove.

Steps to remove a Docker image by ID:
  1. Open a command-line interface (CLI) or a Docker terminal.

  2. List the Docker images present on your system:

    docker images
    

    This will display a list of Docker images along with their IDs, tags, and sizes.

  3. Identify the ID of the image you want to remove from the list.

  4. Execute the following command to remove the image using its ID:

    docker rmi <image-id>
    

    Replace <image-id> with the actual ID of the image you want to remove.

    For example:

    docker rmi 8dfafdbc3a40
    

    This command will remove the specified Docker image from your system.

    Note: If the image is currently being used by a running container, you will need to stop and remove the container first before removing the image.

  5. Verify that the image has been successfully removed:

    docker images
    

    The image should no longer appear in the list.

It is important to note that once you remove a Docker image, it cannot be recovered. Therefore, exercise caution when removing images as it will permanently delete them from your system.

Markdown标记:

docker rmi <image-id>

docker rmi <image-id>
docker rmi <image-id>