Automation Suite
2023.10
False
横幅背景图像
Linux 版 Automation Suite 安装指南
上次更新日期 2024年4月19日

如何在升级后从旧安装程序中删除映像

如果在执行升级后遇到映像漏洞或存储消耗问题,可以从旧的安装程序中删除映像。

要执行此可选的升级后操作,请执行以下步骤:

  1. 根据以下脚本中的集群配置更新 IMGTAGUSERPASSregistrylatest_image_json,然后运行该脚本:
    #!/bin/bash
    
    ### Please change below variables as required
    IMG=<E.g. dataservice/dataservice-designer>
    TAG=<E.g. v20231116-tag>
    USER=<E.g. "admin">
    PASS=<E.g. "password">
    registry=<E.g. "registry.mycluster.com">
    latest_image_json=<E.g. "/opt/UiPathAutomationSuite/UiPath_Installer/versions/docker-images.json">
    ####
    
    [[ -f "${latest_image_json}" ]] || {
    	echo "File "$latest_image_json" doesn't exist"
    	exit 1
    }
    
    cat "${latest_image_json}" | tr -d '",' | grep -w "${IMG}:${TAG}" >> /dev/null && {
    	echo "Image ${IMG}:${TAG} is being used in cluster. Will skip the deletion."
    	exit 0
    }
    
    echo "Deleting image ${IMG}:${TAG}"
    
    cred="-u ${USER}:${PASS}"
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.layers | .[] | .digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.config.digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done#!/bin/bash
    
    ### Please change below variables as required
    IMG=<E.g. dataservice/dataservice-designer>
    TAG=<E.g. v20231116-tag>
    USER=<E.g. "admin">
    PASS=<E.g. "password">
    registry=<E.g. "registry.mycluster.com">
    latest_image_json=<E.g. "/opt/UiPathAutomationSuite/UiPath_Installer/versions/docker-images.json">
    ####
    
    [[ -f "${latest_image_json}" ]] || {
    	echo "File "$latest_image_json" doesn't exist"
    	exit 1
    }
    
    cat "${latest_image_json}" | tr -d '",' | grep -w "${IMG}:${TAG}" >> /dev/null && {
    	echo "Image ${IMG}:${TAG} is being used in cluster. Will skip the deletion."
    	exit 0
    }
    
    echo "Deleting image ${IMG}:${TAG}"
    
    cred="-u ${USER}:${PASS}"
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.layers | .[] | .digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.config.digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
  2. 重新启动注册表 Pod 以执行垃圾收集,或在注册表 Pod 中执行并使用以下命令运行垃圾收集:

    registry garbage-collect /etc/docker/registry/config.ymlregistry garbage-collect /etc/docker/registry/config.yml

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.