8.6 Removing the Docker Images From a Node

OpenStack services are deployed to target nodes as Docker containers. When you deploy services, the Docker daemon on the target node pulls (downloads) the required Docker images from a Docker registry, and uses the images to create the containers.

You may want to remove all the images from a target node to ensure that fresh images are downloaded when you deploy services, and to save disk space. You can only remove an image if it is not being used by any containers (running or stopped) on the node

You can remove the OpenStack Docker images from a node when you use the kollacli host destroy command to remove OpenStack services from a target node by using the --removeimages option:

$ kollacli host destroy --removeimages host | all

If you want to always remove the images when you remove OpenStack services from a node, you can configure this behavior by setting the destroy_include_images property:

$ kollacli property set destroy_include_images True

To remove all images manually, run the following command on the target node:

# docker rmi -f $(docker images -q)
Caution

This command removes all Docker images from the target node, and not just the OpenStack images.

To remove just the OpenStack images, run the following command on the target node:

# docker rmi -f $(docker images -a --filter "label=kolla_version" --format "{{.ID}}")