automation-suite
2023.4
false
重要 :
请注意此内容已使用机器翻译进行了部分本地化。
UiPath logo, featuring letters U and I in white
Linux 版 Automation Suite 安装指南
Last updated 2024年11月21日

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

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

从 Automation Suite 2023.4.8 开始,您可以在升级后使用以下命令从集群内 Docker 注册表清理以前的版本映像:

  • 要删除升级后不再需要的映像,请执行以下操作:

    cd /opt/UiPathAutomationSuite/<new_version>/installer
    ./bin/uipathctl registry cleanup --manifest versions/docker-images.jsoncd /opt/UiPathAutomationSuite/<new_version>/installer
    ./bin/uipathctl registry cleanup --manifest versions/docker-images.json
  • 要删除按需捆绑包映像,您需要专门删除以下映像:

    ./bin/uipathctl registry cleanup --manifest /versions/docker-images.json --images-list images-list.json./bin/uipathctl registry cleanup --manifest /versions/docker-images.json --images-list images-list.json
    以下示例显示了images-list.json文件的格式:
    {
        "cleanup-list": [
            "aicenter/python39:23.10.0-rc4",
            "image2",
            "image3"
        ]
    }{
        "cleanup-list": [
            "aicenter/python39:23.10.0-rc4",
            "image2",
            "image3"
        ]
    }

对于以前的 Automation Suite 版本,要执行此可选的升级后操作,请执行以下步骤:

  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 Logo White
信任与安全
© 2005-2024 UiPath。保留所有权利。