manage delete-images

Remove images that are no longer needed from the private container registry or from the intermediary container registry.

Extended description

To run this command, the registry must be configured to allow images to be removed.

The command examines the images in the following CASE packages:
  • The CASE package for the release that you want to delete (--release_to_delete)
  • The CASE package for the release that you want to keep (--release_to_keep)

The command uses the CASE packages to determine which images can be deleted because they are unique to the release that you want to delete.

Important: If the registry is in a restricted network, you must download the CASE packages to the client workstation before you run this command.

Syntax

cpd-cli manage delete-images \
--release_to_delete=<version> \
--release_to_keep=<version> \
--components=<comma-separated-list-of-component-names> \
--target_registry=<registry-URL> \
[--preview=true|false]

Arguments

The delete-images command has no arguments.

Options

Option Description
--components A comma-separated list of the components that you want to install or upgrade.
Status
Required.
Syntax
--components=<comma-separated-list-of-component-names>
Default value
There is no default value. The list depends on which components you want to install or upgrade.
Valid values
For the list of components, see Component IDs.

You can specify individual components or a comma-separated list of components.

--preview Preview the commands that run when you issue this CLI command.

The command issues a series of oc commands. You can optionally see the list of oc commands that are associated with the command.

The oc commands are saved to the preview.sh file in the cpd-cli-workspace/olm-utils-workspace/work directory.

Status
Optional.
Syntax
--preview=true|false
Default value
false

If you omit this option, the default value is used.

Valid values
false
Run the commands to apply the changes to your cluster.
true
Preview the commands without running them.

You can optionally copy the oc commands from the output and run them yourself. However, this method is not recommended. When you run the commands manually, you do not have access to the additional helper scripts that are included in the underlying Ansible® playbook.

--release_to_delete The version for which you want to remove unused images.
Status
Required.
Syntax
--release_to_delete=<version>
Default value
No default. You must specify the release.
Valid values
  • 4.6.0
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.6.5
  • 4.6.6
--release_to_keep The version for which you want to keep the images.

The list of images that is associated with this release is used to determine which images must not be deleted.

Status
Required.
Syntax
--release_to_keep=<version>
Default value
No default. You must specify the release.
Valid values
  • 4.6.0
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.6.5
  • 4.6.6
--target_registry The URL of the registry that you want to remove the images from.
Status
Required.
Syntax
--target_registry=<registry-URL>
Default value
No default.
Valid values
Specify the URL of the registry, either:
  • The URL of the private container registry
  • The URL of the intermediary container registry, 127.0.0.1:12443

Examples

Note: The following example uses the recommended installation environment variables.

Use a script to create environment variables with the correct values for your environment. For details, see Best practice: Setting up install variables.

Remove unused images from your private container registry for the 4.6.0 release after upgrading to the 4.6.1 release
cpd-cli manage delete-images \
--release_to_delete=4.6.0 \
--release_to_keep=4.6.1 \
--components=${COMPONENTS} \
--target_registry=${PRIVATE_REGISTRY_LOCATION}
Preview the oc commands to remove unused images from your private container registry for the 4.6.0 release after upgrading to the 4.6.1 release
cpd-cli manage delete-images \
--release_to_delete=4.6.0 \
--release_to_keep=4.6.1 \
--components=${COMPONENTS} \
--target_registry=${PRIVATE_REGISTRY_LOCATION} \
--preview=true