Skip to content

Commit

Permalink
#554 Clean up old docker images for deployer
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Ketelaars <fketelaars@nl.ibm.com>
  • Loading branch information
fketelaars committed Feb 8, 2025
1 parent bdcdf9a commit 9aa7045
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LABEL authors="Arthur Laimbock, \
Markus Wiegleb, \
Frank Ketelaars, \
Jiri Petnik"
LABEL product=cloud-pak-deployer

USER 0

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LABEL authors="Arthur Laimbock, \
Markus Wiegleb, \
Frank Ketelaars, \
Jiri Petnik"
LABEL product=cloud-pak-deployer

USER 0

Expand Down
10 changes: 7 additions & 3 deletions cp-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ command_usage() {
echo " --air-gapped Only for environment subcommand; if specified the deployer is considered to run in an air-gapped environment (\$CPD_AIRGAP)"
echo " --skip-mirror-images Pertains to env apply and env download. When specified, the mirroring of images to the private registry is skipped (\$CPD_SKIP_MIRROR)"
echo " --skip-portable-registry Pertains to env download. When specified, no portable registry is used to transport the images (\$CPD_SKIP_PORTABLE_REGISTRY)"
echo " --clean-up Remove the container after the run is completed (\$CPD_CLEANUP)"
echo " --clean-up Remove the container after the run is completed. Remove old images after build. (\$CPD_CLEANUP)"
echo " -v Show standard ansible output (\$ANSIBLE_STANDARD_OUTPUT)"
echo " -vv, -vvv, -vvvv, ... Show verbose ansible output, verbose option used is (number of v)-1 (\$ANSIBLE_VERBOSE)"
echo
Expand Down Expand Up @@ -584,8 +584,8 @@ while (( "$#" )); do
shift 1
;;
--clean-up)
if [[ "${ACTION}" != "apply" && "${ACTION}" != "destroy" && "${ACTION}" != "download" && "${SUBCOMMAND}" != "vault" ]];then
echo "Error: --clean-up is only valid for environment subcommand with apply/destroy or download or the vault subcommand."
if [[ "${ACTION}" != "apply" && "${ACTION}" != "destroy" && "${ACTION}" != "download" && "${SUBCOMMAND}" != "vault" && "${SUBCOMMAND}" != "build" ]];then
echo "Error: --clean-up is only valid for environment subcommand with apply/destroy, or the download, build or vault subcommand."
command_usage 2
fi
export CPD_CLEANUP=true
Expand Down Expand Up @@ -709,6 +709,10 @@ if ! $INSIDE_CONTAINER;then
--build-arg CPD_OLM_UTILS_V3_IMAGE=${CPD_OLM_UTILS_V3_IMAGE} \
--platform linux/${IMAGE_ARCH} \
${SCRIPT_DIR}
if "$CPD_CLEANUP";then
echo "Cleaning up old Cloud Pak Deployer images..."
${CPD_CONTAINER_ENGINE} image prune -f --filter label=product=cloud-pak-deployer
fi
exit $?
fi
fi
Expand Down
7 changes: 5 additions & 2 deletions docs/src/05-install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
To install and run the Cloud Pak Deployer, ensure that either podman or docker is available on your system. These are typically available on various Linux distributions such as Red Hat Enterprise Linux (preferred), Fedora, CentOS, Ubuntu, and MacOS. Note that Docker behaves differently on Windows compared to Linux platforms, potentially causing deployment issues.

!!! info
If you plan to run Cloud Pak Deployer from the OpenShift console, you can skip these steps. A Cloud Pak Deployer container image is already available on quay.io, to be used in an OpenShift job.
If you plan to run Cloud Pak Deployer from the OpenShift console, you can skip these steps. A Cloud Pak Deployer container image is already available on quay.io, to be used in an OpenShift job. For running Cloud Pak Deployer from the OpenShift console, please refer to [Run on OpenShift using console](../10-use-deployer/3-run/existing-openshift-console)

### Using a Windows workstation

Expand Down Expand Up @@ -60,11 +60,14 @@ cd cloud-pak-deployer

Then run the following command to build the container image.
``` { .bash .copy }
./cp-deploy.sh build
./cp-deploy.sh build [--clean-up]
```

This process will take 5-10 minutes to complete and it will install all the pre-requisites needed to run the automation, including Ansible, Python and required operating system packages. For the installation to work, the system on which the image is built must be connected to the internet.

!!! info
If you want to keep your system clean if you're regularly building the Cloud Pak Deployer image, you can add the `--clean-up` option or set environment variable `CPD_CLEANUP` to `true`.

## Downloading the Cloud Pak Deployer Image from Registry

To download the Cloud Pak Deployer image from the Quay.io registry, you can use the Docker command-line interface (CLI) or Podman.
Expand Down

0 comments on commit 9aa7045

Please sign in to comment.