diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2f7845a..0364d07 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -80,15 +80,11 @@ jobs: ${{ env.DOCKER_NAMESPACE }}/${{ env.DOCKER_IMAGE_NAME }}:latest platforms: linux/amd64,linux/arm64 - - name: Login and sync images to Aliyun registry + - name: sync images to Huawei Cloud Container registry run: | chmod +x ./bin/skopeo ./bin/skopeo copy --all docker://docker.io/${{ env.DOCKER_NAMESPACE }}/udocker:v1.1.3 docker://${{ env.DOCKER_REGISTRY_HUAWEI }}/${{ env.DOCKER_NAMESPACE }}/udocker:v1.1.3 ./bin/skopeo copy --all docker://docker.io/${{ env.DOCKER_NAMESPACE }}/udocker:latest docker://${{ env.DOCKER_REGISTRY_HUAWEI }}/${{ env.DOCKER_NAMESPACE }}/udocker:latest - - - - release: needs: build diff --git a/apps/urls.py b/apps/urls.py index ea9b121..f3ba65b 100644 --- a/apps/urls.py +++ b/apps/urls.py @@ -29,6 +29,7 @@ re_path("get_registries_list/",views.get_registries_list,name="get_registries_list"), re_path("get_volumes_list/",views.get_volumes_list,name="get_volumes_list"), re_path("get_network_list/",views.get_network_list,name="get_network_list"), + re_path("get_historicalmirror_list/",views.get_historicalmirror_list,name="get_historicalmirror_list"), re_path("docker_network_info/",views.docker_network_info,name="docker_network_info"), # 远程docker网络管理页面 re_path("docker_network_api/",views.docker_network_api,name="docker_network_api"), # 远程docker网络管理API diff --git a/apps/views.py b/apps/views.py index 5c06b1a..8110784 100644 --- a/apps/views.py +++ b/apps/views.py @@ -1135,6 +1135,44 @@ def get_volumes_list(request): except DockerException as e: logger.error(e) +# 回显历史镜像版本 +@login_required +def get_historicalmirror_list(request): + mirror_data = [] + image_info = request.GET.get("image") + print("传递的镜像:",image_info) + try: + #容器管理模块API + success, client = docker_mod.connect_to_docker() + if success: + #image_info = [item['image'] for item in request_data] + # 获取所有镜像列表 + images = client.images.list() + + # 过滤出属于特定仓库的镜像 + specific_images = [] + for image in images: + for digest in image.attrs.get('RepoDigests', []): + # 使用image_info中的值替换原有的匹配规则 + if digest and digest.startswith(image_info.split(':')[0] + '@'): + specific_images.append(image) + break + # 构建返回的历史镜像数据 + historical_mirror_data = [] + for image in specific_images: + tag_version = image.tags[0].split(':')[-1] if image.tags else '' + historical_mirror_data.append({ + 'REPOSITORY': image.tags[0] if image.tags else '', + 'TAG': tag_version, + 'IMAGE ID': image.short_id, + 'CREATED': image.attrs['Created'], + 'SIZE': image.attrs['VirtualSize']/1024/1024, + }) + print("数据:",historical_mirror_data) + return render(request, 'container/docker_mirror.html',{"historical_mirror_data":historical_mirror_data}) + except DockerException as e: + logger.error(e) + # 网络管理 @login_required diff --git a/templates/container/docker_container_list.html b/templates/container/docker_container_list.html index 67c07d5..3b5aa25 100644 --- a/templates/container/docker_container_list.html +++ b/templates/container/docker_container_list.html @@ -58,6 +58,7 @@ + {% endif %} + +