|
59 | 59 | cmd = systems[image["system"]]["cmd"] |
60 | 60 | tag = f"{args.tag}{image['tag_suffix']}" |
61 | 61 | full_tag = f"{image['image']}:{tag}" |
| 62 | + logger.debug(f"Pulling image {full_tag} for platform {platform}") |
62 | 63 | try: |
63 | | - i = client.images.get(full_tag) |
64 | | - ## check if the image is for the correct platform |
65 | | - image_platform = f"{i.attrs.get('Os', '')}/{i.attrs.get('Architecture', '')}" |
66 | | - if platform != image_platform: |
67 | | - raise docker.errors.ImageNotFound( |
68 | | - f"Image {full_tag} is not for platform {platform}, found {image_platform}" |
69 | | - ) |
70 | | - except docker.errors.ImageNotFound: |
71 | | - ## pull the image |
72 | | - logger.debug(f"Pulling image {full_tag} for platform {platform}") |
73 | | - try: |
74 | | - client.images.remove(full_tag, force=True) |
75 | | - except Exception: |
76 | | - pass |
77 | | - i = client.images.pull(repository=image_name, tag=tag, platform=platform) |
78 | | - logger.debug(f"Image {i.id} pulled successfully") |
| 64 | + client.api.pull(repository=image_name, tag=tag, platform=platform) |
| 65 | + logger.debug(f"Image {full_tag} for platform {platform} pulled successfully") |
| 66 | + except Exception as e: |
| 67 | + logger.debug(f"Pull attempt error: {e}") |
79 | 68 | for package in image["packages"]: |
80 | 69 | command = f"{cmd} {package['name']}" |
81 | 70 | output = "" |
82 | 71 | try: |
83 | 72 | output = client.containers.run( |
84 | | - i.id, |
| 73 | + full_tag, |
85 | 74 | command, |
86 | 75 | entrypoint="", |
87 | 76 | platform=platform, |
|
91 | 80 | except (docker.errors.ContainerError, docker.errors.NotFound) as e: |
92 | 81 | logger.debug(f"{e}, retrying") |
93 | 82 | output = client.containers.run( |
94 | | - i.id, |
| 83 | + full_tag, |
95 | 84 | command, |
96 | 85 | entrypoint="", |
97 | 86 | platform=platform, |
|
0 commit comments